Skip to main content

Improve the snippet script

ID
0b31c4a
date
2024-07-15 08:12:11+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
38d4920
message
Improve the snippet script
changed files
1 file, 7 additions

Changed files

make_alfred_snippet.sh (1068) → create_alfred_snippet.sh (1398)

diff --git a/make_alfred_snippet.sh b/create_alfred_snippet.sh
similarity index 92%
rename from make_alfred_snippet.sh
rename to create_alfred_snippet.sh
index 715aa5d..dd14ace 100755
--- a/make_alfred_snippet.sh
+++ b/create_alfred_snippet.sh
@@ -10,6 +10,9 @@ KEYWORD="!html"
 ROOT=$(git rev-parse --show-toplevel)
 
 pushd $(mktemp -d)
+
+  # 1. Create the `info.plist` files with the settings for this collection
+  #    of snippets: no keyword prefix/suffix.
   cat > info.plist <<EOF
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@@ -29,6 +32,8 @@ EOF
   # This is an arbitrary choice of ID; it just has to be used consistently
   snippet_id="$(uuidgen)"
 
+  # 2. Create the snippet JSON file, which expands the HTML when I type the
+  #    given keyword.
   cat > "$snippet_id.json" <<EOF
 {
     "alfredsnippet": {
@@ -40,6 +45,8 @@ EOF
 }
 EOF
 
+  # 3. Bundle the info.plist and snippet JSON into an `alfredsnippets`
+  #    package, and open it in Alfred.
   zip "HTML template.alfredsnippets" "info.plist" "$snippet_id.json"
   open "HTML template.alfredsnippets"
 popd