Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reworking of verbose-form-template package #162

Merged
merged 1 commit into from
Mar 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions packages/verbose-form-template/1.0.1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Espanso Form Extension Shortcut

> This package allows you to quickly create a new Espanso shortcut containing a list Form extension. Please see the example below.

## Usage

Let's say you want to create a new Espanso shortcut that will allow you to choose between different options such as a list of colors that you frequently use in styling. Or you have a list of co-worker logins that you need to use but can't always remember off-hand. You can use the Form extension to quickly generate a shortcut template to give you a list of options to choose from.

Type `:vblf` (verbose list form) in your YAML code-editor and complete the information in the popup form. Once you click `Submit` a form trigger will be pasted in its place. Further edits, such as additional options, or changing the field `type:` to `choice`, can then be inserted.

Please see [![espanso-verbose-form-template](https://img.youtube.com/vi/videoid/0.jpg)](https://www.youtube.com/watch?v=VEGv4aHV1d8)
for a short video demo of an earlier version.

```yaml
# Example usage

- triggers: ['csscolors--', 'csscol--']
replace: "color: {{CSS.color_name}}"
vars:
- name: "CSS"
type: form
params:
layout: "color_name: [[color_name]]"
fields:
color_name:
type: list
values:
- red
- orange
- black
- white
- green
- blue
- purple
- pink
- yellow
- brown
- gray
- cyan
- magenta
- lime
- teal
- indigo
- violet
- fuchsia
- aqua
- maroon
- navy
- olive
- silver
- limegreen
- skyblue
- tan
```

## Source

Please refer to the awesome documentation for verbose syntax forms here https://espanso.org/docs/matches/forms/#controls-with-the-verbose-syntax
9 changes: 9 additions & 0 deletions packages/verbose-form-template/1.0.1/_manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: verbose-form-template
title: A form trigger to generate form triggers!
version: 1.0.1
author: Omar Elmenawi, reworked by Stephen Meech
description: Espanso shortcode to create espanso forms with the list extension
tags: ["shortcut", "template", "form", "yml"]
homepage: https://github.com/menawi/hub/tree/main/packages


42 changes: 42 additions & 0 deletions packages/verbose-form-template/1.0.1/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/espanso/espanso/dev/schemas/match.schema.json

matches:

# Description:
# - Allows you to specify:
# - form name
# - trigger
# - variable
# - replace
# - three starter list options

- trigger: ':vblf'
label: 'Espanso: Form - Verbose'
replace: |2-
- triggers: ['{{FORM.trigger}}']
replace: "{{FORM.replace}} {{{{FORM.form_name}}.{{FORM.variable}}}}"
vars:
- name: {{FORM.form_name}}
type: form
params:
layout: "{{FORM.variable}}: [[{{FORM.variable}}]]"
fields:
{{FORM.variable}}:
type: list
values:
- {{FORM.list_option_one}}
- {{FORM.list_option_two}}
- {{FORM.list_option_three}}
vars:
- name: FORM
type: form
params:
layout: |-
Trigger: [[trigger]] Replace text: [[replace]]
Form:
Name: [[form_name]] Variable: [[variable]]
Form list:
Option one: [[list_option_one]]
Option two: [[list_option_two]]
Option three: [[list_option_three]]