-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Much amended version of part of the failed PR #87. It's been over a year since the original submission and I have been unable to get a response from @mistahBen, even going as far as submitting a PR mistahBen#1 to his own repo. I like this package as it illustrates a useful technique, so I think it's worth preserving. Thanks to @mistahBen for the idea!
- Loading branch information
Showing
4 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Form list | ||
## A package for getting a list of expansions from one form via a CSV list. | ||
|
||
# Setup | ||
The `package.yml` does not need to be edited. | ||
|
||
You will need to edit the entries in the `form_urls.csv`. The sample lines are a good starting point. The basic syntax is: | ||
|
||
| Name/description (without quotes) | URL | | ||
| --- | --- | | ||
| gmail | https://gmail.com/ | | ||
|
||
**Separate the two fields with a comma.** Remember to save the file! | ||
|
||
## Reuse | ||
|
||
You can of course also copy the contents of this package and create multiple form lists with other text. 👍 If you do so, you will need to edit the global variable for the location of the csv file. | ||
|
||
Requires Python, but if present should work in all OSs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
name: "form-list" | ||
title: "Form URLs List" | ||
description: Uses a CSV to present a list of links and then pastes the chosen URL. | ||
version: 0.2.0 | ||
author: Ben Alexander (mistahben), contributions Stephen Meech (smeech) | ||
tags: ["utility", "internet", "URL", "CSV", "forms"] | ||
homepage: https://github.com/Various-forks/mistahBen_espanso_hub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Espanso documentation, https://espanso.org/docs/ | ||
DuckDuckGo, https://duckduckgo.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/espanso/espanso/dev/schemas/match.schema.json | ||
|
||
global_vars: | ||
- name: urlcsv | ||
type: shell | ||
params: | ||
cmd: echo "$CONFIG/match/packages/form-list/0.2.0/form_urls.csv" | ||
|
||
matches: | ||
- trigger: :forms | ||
replace: '{{form_url}}' | ||
vars: | ||
- name: form_names | ||
type: script | ||
params: | ||
args: | ||
- python | ||
- -c | ||
- | | ||
import csv | ||
with open('{{urlcsv}}', newline='') as f: | ||
for row in csv.reader(f): print(row[0]) | ||
- name: choice | ||
type: form | ||
params: | ||
layout: | | ||
Get link to D65 form: | ||
[[choices]] | ||
fields: | ||
choices: | ||
type: list | ||
values: '{{form_names}}' | ||
- name: form_url | ||
type: script | ||
params: | ||
args: | ||
- python | ||
- -c | ||
- | | ||
import csv | ||
with open('{{urlcsv}}', newline='') as f: | ||
for row in csv.reader(f): | ||
if row[0] == '{{choice.choices}}': | ||
print(row[1]) | ||
break | ||