From 22998a5f75be1924987fcc96fa57604d42ad0efc Mon Sep 17 00:00:00 2001 From: smeech Date: Sat, 14 Dec 2024 18:09:48 +0000 Subject: [PATCH 1/2] Mistake removed Removed `"0.2.0,"` from the code, that prevented it working. --- packages/form-list/0.2.1/README.md | 19 +++++++++ packages/form-list/0.2.1/_manifest.yml | 7 ++++ packages/form-list/0.2.1/form_urls.csv | 2 + packages/form-list/0.2.1/package.yml | 54 ++++++++++++++++++++++++++ 4 files changed, 82 insertions(+) create mode 100644 packages/form-list/0.2.1/README.md create mode 100644 packages/form-list/0.2.1/_manifest.yml create mode 100644 packages/form-list/0.2.1/form_urls.csv create mode 100644 packages/form-list/0.2.1/package.yml diff --git a/packages/form-list/0.2.1/README.md b/packages/form-list/0.2.1/README.md new file mode 100644 index 0000000..a56c8fa --- /dev/null +++ b/packages/form-list/0.2.1/README.md @@ -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! Ensure you retain its UTF-8 encoding - spreadsheet programs may switch to UTF-8-BOM. + +## 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 operating systems. \ No newline at end of file diff --git a/packages/form-list/0.2.1/_manifest.yml b/packages/form-list/0.2.1/_manifest.yml new file mode 100644 index 0000000..a60a326 --- /dev/null +++ b/packages/form-list/0.2.1/_manifest.yml @@ -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), updated by Stephen Meech (smeech) +tags: ["utility", "internet", "URL", "CSV", "forms"] +homepage: https://github.com/smeech diff --git a/packages/form-list/0.2.1/form_urls.csv b/packages/form-list/0.2.1/form_urls.csv new file mode 100644 index 0000000..82b3a03 --- /dev/null +++ b/packages/form-list/0.2.1/form_urls.csv @@ -0,0 +1,2 @@ +Espanso documentation, https://espanso.org/docs/ +DuckDuckGo, https://duckduckgo.com \ No newline at end of file diff --git a/packages/form-list/0.2.1/package.yml b/packages/form-list/0.2.1/package.yml new file mode 100644 index 0000000..592c4d3 --- /dev/null +++ b/packages/form-list/0.2.1/package.yml @@ -0,0 +1,54 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/espanso/espanso/dev/schemas/match.schema.json + +global_vars: + # OS-agnostic derivation of path to CSV file. + - name: urlcsv + type: script + params: + args: + - python + - -c + - | + import os + config_path = os.getenv("CONFIG") + print(os.path.join(config_path, "match", "packages", "form-list", "form_urls.csv")) + +matches: + - trigger: :forms + replace: '{{form_url}}' + vars: + # Read choice-list options from CSV file. + - name: form_names + type: script + params: + args: + - python + - -c + - | + import csv + with open(r'{{urlcsv}}', newline='') as f: + for row in csv.reader(f): print(row[0]) + # Form + - name: choice + type: form + params: + layout: | + Get link for: + [[choices]] + fields: + choices: + type: list + values: '{{form_names}}' + # Return paired item as selected above + - name: form_url + type: script + params: + args: + - python + - -c + - | + import csv + with open(r'{{urlcsv}}', newline='') as f: + for row in csv.reader(f): + if row[0] == '{{choice.choices}}': + print(row[1]) ; break From f5447f6ffd94269d04ed9d91802fc295e7d9d994 Mon Sep 17 00:00:00 2001 From: smeech Date: Sat, 14 Dec 2024 18:12:45 +0000 Subject: [PATCH 2/2] Update _manifest.yml --- packages/form-list/0.2.1/_manifest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/form-list/0.2.1/_manifest.yml b/packages/form-list/0.2.1/_manifest.yml index a60a326..8d31359 100644 --- a/packages/form-list/0.2.1/_manifest.yml +++ b/packages/form-list/0.2.1/_manifest.yml @@ -1,7 +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 +version: 0.2.1 author: Ben Alexander (mistahBen), updated by Stephen Meech (smeech) tags: ["utility", "internet", "URL", "CSV", "forms"] homepage: https://github.com/smeech