diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d1b6ea9 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,28 @@ +name: Release Alfred Workflow +on: + push: + branches: + - main + +permissions: + contents: read # for checkout + +jobs: + release: + name: Release + runs-on: macos-latest + permissions: + contents: write + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: "lts/*" + - name: Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: npx -p @semantic-release/git -p @semantic-release/github -p @semantic-release/exec semantic-release diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..21938ef --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.DS_Store +prefs.plist diff --git a/.releaserc b/.releaserc new file mode 100644 index 0000000..55f2f7d --- /dev/null +++ b/.releaserc @@ -0,0 +1,22 @@ +{ + "branches": ["main"], + "plugins": [ + ["@semantic-release/commit-analyzer", { + "preset": "angular", + "releaseRules": [ + {"release": "patch"} + ] + }], + "@semantic-release/release-notes-generator", + ["@semantic-release/exec", { + "prepareCmd": "./.zip.sh ${nextRelease.version}" + }], + ["@semantic-release/git", { + "assets": ["info.plist"], + "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" + }], + ["@semantic-release/github", { + "assets": ["Reading-list.alfredworkflow"] + }] + ] +} diff --git a/.zip.sh b/.zip.sh new file mode 100755 index 0000000..d5e08d9 --- /dev/null +++ b/.zip.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +# ----------------------- +# new version number +# ----------------------- + +# Prompt for version number, if not entered +nextVersion="$*" +currentVersion=$(plutil -extract 'version' raw -o - info.plist) +echo "current version: $currentVersion" +echo -n " next version: " +if [[ -z "$nextVersion" ]]; then + read -r nextVersion +else + echo "$nextVersion" +fi + +# insert new version number +plutil -replace version -string "$nextVersion" info.plist + +# ----------------------- +# clean info.plist +# ----------------------- + +# bkp info.plist +cp -v info.plist info-original.plist + +# remove variables flagged as "no export" from info.plist +if plutil -extract 'variablesdontexport' json -o - info.plist &>/dev/null; then + excludedVars=$(plutil -extract variablesdontexport json -o - info.plist | tr -d "[]\"" | tr "," "\n") + echo "$excludedVars" | tr "\n" "\0" | xargs -0 -I {} plutil -replace variables.{} -string "" info.plist + + exclusionNo=$(echo "$excludedVars" | wc -l | tr -d " ") + echo "Removed $exclusionNo variables flagged as 'no export' removed from 'info.plist'." +fi + +# ----------------------- +# compile .alfredworkflow +# ----------------------- + +# remove workflow file from previous release +rm -fv ./*.alfredworkflow + +# zip +workflowName=$(plutil -extract 'name' raw -o - info.plist | tr " " "-") +# ".*" excludes the dotfiles (glob pattern, not regex) +zip --quiet -r "$workflowName.alfredworkflow" . -x ".*" "doc*/*" "prefs.plist" "info-original.plist" "*.md" "*.alfredworkflow" "*.gif" +echo "new $workflowName.alfredworkflow file created." + +# restore original +rm -fv info.plist +mv -fv info-original.plist info.plist +echo diff --git a/README.md b/README.md new file mode 100644 index 0000000..0fbd1c7 --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +![String Multitool](./icon.png) + +# Reading list + +[Alfred](https://www.alfredapp.com/) workflow helping you manage your links and quick search notes. + +## Usage +Use keyword `string` (or custom keyword) to init String Multitool. Provide string as an argument and select needed transformation from list. \ No newline at end of file diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..9448fd7 Binary files /dev/null and b/icon.png differ diff --git a/info.plist b/info.plist new file mode 100644 index 0000000..274c574 --- /dev/null +++ b/info.plist @@ -0,0 +1,1275 @@ + + + + + bundleid + reading.list + category + Productivity + connections + + 07462418-C42F-4168-B2C5-BFC05E6997EA + + + destinationuid + 96F2DB4E-9135-43AC-8A32-92DD15BB6693 + modifiers + 0 + modifiersubtext + + vitoclose + + + + 128CDF67-6A8F-4993-B5CC-492CFC101AC4 + + + destinationuid + 2A7F4EEC-9CDA-415D-8D94-840326F56446 + modifiers + 0 + modifiersubtext + + vitoclose + + + + 2A7F4EEC-9CDA-415D-8D94-840326F56446 + + + destinationuid + 4E2B0C6B-5409-40E2-B596-462E5FC927A9 + modifiers + 0 + modifiersubtext + + vitoclose + + + + 2ED2B2E9-BACA-49D5-86A5-8E6EE62991AF + + + destinationuid + 940281B8-B904-4115-ABC3-F6BF9F68EC2F + modifiers + 0 + modifiersubtext + + vitoclose + + + + 446F8E5A-D2C9-4E82-B811-489F83D6107F + + + destinationuid + 97622ECB-E7D8-4A7F-8D24-01E8E35780F2 + modifiers + 0 + modifiersubtext + + vitoclose + + + + 4E2B0C6B-5409-40E2-B596-462E5FC927A9 + + + destinationuid + 8C10DDB1-AF6C-4DC0-A8A9-98AFBD5B8108 + modifiers + 0 + modifiersubtext + + vitoclose + + + + 4FA59109-6D15-4646-B276-0173CC8E24C2 + + + destinationuid + 8C5FCB86-BC89-462E-949F-DFA50BC684BB + modifiers + 0 + modifiersubtext + + vitoclose + + + + 55536DCF-62A7-4E8C-8196-910B271432E1 + + + destinationuid + 5C434A4E-AE0D-4AC3-903B-DC57FD94E82A + modifiers + 0 + modifiersubtext + + vitoclose + + + + 5AC036FB-A3C0-436B-B7C7-C0B233864760 + + + destinationuid + 638D60CD-3905-4F5D-869E-B1561A989818 + modifiers + 0 + modifiersubtext + + vitoclose + + + + 5C434A4E-AE0D-4AC3-903B-DC57FD94E82A + + + destinationuid + 234CC09E-2B28-4152-BE00-1104084F6E31 + modifiers + 0 + modifiersubtext + + vitoclose + + + + 638D60CD-3905-4F5D-869E-B1561A989818 + + + destinationuid + E1FA3357-9FCA-40A0-95E5-DE3528FC1F62 + modifiers + 0 + modifiersubtext + + vitoclose + + + + 7184DE64-72F9-40F5-ABE4-2D65C3441ED1 + + + destinationuid + 97622ECB-E7D8-4A7F-8D24-01E8E35780F2 + modifiers + 0 + modifiersubtext + + vitoclose + + + + 77770747-4764-4364-9CC0-0204384A925A + + + destinationuid + D9D455FA-C126-49F4-833E-D2DCB965CE42 + modifiers + 0 + modifiersubtext + + vitoclose + + + + 940281B8-B904-4115-ABC3-F6BF9F68EC2F + + + destinationuid + 4FA59109-6D15-4646-B276-0173CC8E24C2 + modifiers + 0 + modifiersubtext + + vitoclose + + + + 96F2DB4E-9135-43AC-8A32-92DD15BB6693 + + + destinationuid + A4DDA684-56D3-4574-BBB5-2EFA23A4F1CE + modifiers + 0 + modifiersubtext + + vitoclose + + + + 97622ECB-E7D8-4A7F-8D24-01E8E35780F2 + + + destinationuid + 55536DCF-62A7-4E8C-8196-910B271432E1 + modifiers + 0 + modifiersubtext + + vitoclose + + + + A013A9B4-3B19-4889-A859-092BEB536969 + + + destinationuid + 07462418-C42F-4168-B2C5-BFC05E6997EA + modifiers + 0 + modifiersubtext + + vitoclose + + + + destinationuid + 5AC036FB-A3C0-436B-B7C7-C0B233864760 + modifiers + 0 + modifiersubtext + + vitoclose + + + + A4DDA684-56D3-4574-BBB5-2EFA23A4F1CE + + + destinationuid + E8BADEFB-E178-4BE6-B35A-F2A5A9A1EF17 + modifiers + 0 + modifiersubtext + + sourceoutputuid + ACA65CAA-E8A3-4440-A5AB-26CE32690934 + vitoclose + + + + destinationuid + 248951AF-CC02-4C99-8B83-C076BA1F7165 + modifiers + 0 + modifiersubtext + + vitoclose + + + + ADB99D1F-284A-4D23-A3C2-AD058AA42882 + + + destinationuid + 446F8E5A-D2C9-4E82-B811-489F83D6107F + modifiers + 0 + modifiersubtext + + vitoclose + + + + destinationuid + 7184DE64-72F9-40F5-ABE4-2D65C3441ED1 + modifiers + 1048576 + modifiersubtext + Show read items + vitoclose + + + + BB31A2CF-BA2D-49D4-9ECD-9305F75C4693 + + + destinationuid + 2ED2B2E9-BACA-49D5-86A5-8E6EE62991AF + modifiers + 0 + modifiersubtext + + vitoclose + + + + D9D455FA-C126-49F4-833E-D2DCB965CE42 + + + destinationuid + BB31A2CF-BA2D-49D4-9ECD-9305F75C4693 + modifiers + 0 + modifiersubtext + + vitoclose + + + + E1FA3357-9FCA-40A0-95E5-DE3528FC1F62 + + + destinationuid + 3F37DA32-7CB6-4BE9-9087-0C8693D5BE39 + modifiers + 0 + modifiersubtext + + sourceoutputuid + ACA65CAA-E8A3-4440-A5AB-26CE32690934 + vitoclose + + + + + createdby + Yuri Mazursky + description + + disabled + + name + Reading list + objects + + + config + + argumenttype + 0 + keyword + rladd + subtext + + text + Add item '{query}' + withspace + + + type + alfred.workflow.input.keyword + uid + 128CDF67-6A8F-4993-B5CC-492CFC101AC4 + version + 1 + + + config + + concurrently + + escaping + 68 + script + function run(argv) { + return argv[0].trim().replace(/\s/g, ' '); +} + scriptargtype + 1 + scriptfile + + type + 7 + + type + alfred.workflow.action.script + uid + 2A7F4EEC-9CDA-415D-8D94-840326F56446 + version + 2 + + + config + + adduuid + + allowemptyfiles + + createintermediatefolders + + filename + {var:file_path} + filetext + - [ ] {query} + ignoredynamicplaceholders + + relativepathmode + 1 + type + 2 + + type + alfred.workflow.output.writefile + uid + 8C10DDB1-AF6C-4DC0-A8A9-98AFBD5B8108 + version + 1 + + + config + + type + 0 + + type + alfred.workflow.utility.transform + uid + 4E2B0C6B-5409-40E2-B596-462E5FC927A9 + version + 1 + + + config + + argumenttype + 2 + keyword + rlread + skipuniversalaction + + subtext + + text + Read first item + withspace + + + type + alfred.workflow.input.keyword + uid + 77770747-4764-4364-9CC0-0204384A925A + version + 1 + + + config + + concurrently + + escaping + 68 + script + function run(argv) { + ObjC.import('stdlib'); + const list = $.getenv('list'); + + const unreadItem = list.match(/- \[ \] (.+)$/m)?.[1]; + + if (unreadItem) { + return unreadItem; + } + + return ''; +} + scriptargtype + 1 + scriptfile + + type + 7 + + type + alfred.workflow.action.script + uid + 2ED2B2E9-BACA-49D5-86A5-8E6EE62991AF + version + 2 + + + config + + externaltriggerid + open_item + passinputasargument + + passvariables + + workflowbundleid + self + + type + alfred.workflow.output.callexternaltrigger + uid + 8C5FCB86-BC89-462E-949F-DFA50BC684BB + version + 1 + + + config + + concurrently + + escaping + 102 + script + cat "${file_path}" + scriptargtype + 1 + scriptfile + + type + 0 + + type + alfred.workflow.action.script + uid + D9D455FA-C126-49F4-833E-D2DCB965CE42 + version + 2 + + + config + + type + 0 + + type + alfred.workflow.utility.transform + uid + 940281B8-B904-4115-ABC3-F6BF9F68EC2F + version + 1 + + + config + + argument + + passthroughargument + + variables + + list + {query} + + + type + alfred.workflow.utility.argument + uid + BB31A2CF-BA2D-49D4-9ECD-9305F75C4693 + version + 1 + + + config + + argument + + passthroughargument + + variables + + item + {query} + + + type + alfred.workflow.utility.argument + uid + 4FA59109-6D15-4646-B276-0173CC8E24C2 + version + 1 + + + config + + alfredfiltersresults + + alfredfiltersresultsmatchmode + 2 + argumenttreatemptyqueryasnil + + argumenttrimmode + 0 + argumenttype + 2 + escaping + 68 + queuedelaycustom + 3 + queuedelayimmediatelyinitially + + queuedelaymode + 0 + queuemode + 1 + runningsubtext + Getting list... + script + function run(argv) { + ObjC.import('stdlib'); + const list = $.getenv('list').split('\n'); + const showRead = $.getenv('show_read') === 'true'; + const items = []; + + list.forEach((item) => { + const match = item.match(/(?:-|\*) \[(x| )\] (.+)$/m); + + if (!match) { + return; + } + + const isRead = match[1] === 'x'; + const text = match[2]; + + if (showRead !== isRead) { + return; + } + + items.push({ + title: text, + arg: text, + icon: { + path: isRead ? './read.png' : './unread.png', + }, + variables: { + item: text, + }, + }); + }); + + return JSON.stringify({ + skipknowledge: true, + items, + }); +} + scriptargtype + 1 + scriptfile + + subtext + + title + Reading list + type + 7 + withspace + + + type + alfred.workflow.input.scriptfilter + uid + 5C434A4E-AE0D-4AC3-903B-DC57FD94E82A + version + 3 + + + config + + externaltriggerid + open_item + passinputasargument + + passvariables + + workflowbundleid + self + + type + alfred.workflow.output.callexternaltrigger + uid + 234CC09E-2B28-4152-BE00-1104084F6E31 + version + 1 + + + config + + argument + + passthroughargument + + variables + + show_read + false + + + type + alfred.workflow.utility.argument + uid + 446F8E5A-D2C9-4E82-B811-489F83D6107F + version + 1 + + + config + + concurrently + + escaping + 102 + script + cat "${file_path}" + scriptargtype + 1 + scriptfile + + type + 0 + + type + alfred.workflow.action.script + uid + 97622ECB-E7D8-4A7F-8D24-01E8E35780F2 + version + 2 + + + config + + argumenttype + 2 + keyword + rllist + skipuniversalaction + + subtext + Show unread items + text + List + withspace + + + type + alfred.workflow.input.keyword + uid + ADB99D1F-284A-4D23-A3C2-AD058AA42882 + version + 1 + + + config + + argument + + passthroughargument + + variables + + list + {query} + + + type + alfred.workflow.utility.argument + uid + 55536DCF-62A7-4E8C-8196-910B271432E1 + version + 1 + + + config + + argument + + passthroughargument + + variables + + show_read + true + + + type + alfred.workflow.utility.argument + uid + 7184DE64-72F9-40F5-ABE4-2D65C3441ED1 + version + 1 + + + config + + browser + + skipqueryencode + + skipvarencode + + spaces + + url + {var:item} + + type + alfred.workflow.action.openurl + uid + E8BADEFB-E178-4BE6-B35A-F2A5A9A1EF17 + version + 1 + + + config + + concurrently + + escaping + 68 + script + function run(argv) { + ObjC.import('stdlib'); + const item = $.getenv('item'); + const urlRegex = /https?:\/\/([\w-]+(\.[\w-]+)+\/?|localhost|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})(:\d+)?(\/\S*)?$/; + + if (urlRegex.test(item)) { + return 'link'; + } + + return 'text'; +} + scriptargtype + 1 + scriptfile + + type + 7 + + type + alfred.workflow.action.script + uid + 07462418-C42F-4168-B2C5-BFC05E6997EA + version + 2 + + + config + + availableviaurlhandler + + triggerid + open_item + + type + alfred.workflow.trigger.external + uid + A013A9B4-3B19-4889-A859-092BEB536969 + version + 1 + + + config + + browser + + searcher + 1635215215 + + type + alfred.workflow.action.systemwebsearch + uid + 248951AF-CC02-4C99-8B83-C076BA1F7165 + version + 1 + + + config + + conditions + + + inputstring + {query} + matchcasesensitive + + matchmode + 0 + matchstring + link + outputlabel + link + uid + ACA65CAA-E8A3-4440-A5AB-26CE32690934 + + + elselabel + text + hideelse + + + type + alfred.workflow.utility.conditional + uid + A4DDA684-56D3-4574-BBB5-2EFA23A4F1CE + version + 1 + + + config + + type + 0 + + type + alfred.workflow.utility.transform + uid + 96F2DB4E-9135-43AC-8A32-92DD15BB6693 + version + 1 + + + config + + adduuid + + allowemptyfiles + + createintermediatefolders + + filename + {var:file_path} + filetext + {query} + ignoredynamicplaceholders + + relativepathmode + 1 + type + 1 + + type + alfred.workflow.output.writefile + uid + 3F37DA32-7CB6-4BE9-9087-0C8693D5BE39 + version + 1 + + + config + + concurrently + + escaping + 68 + script + function run(argv) { + ObjC.import('stdlib'); + const list = $.getenv('list').split('\n'); + const item = $.getenv('item'); + + for (let index = 0; index < list.length; index++) { + if (list[index].includes(item)) { + list[index] = `- [x] ${item}`; + + return list.join('\n'); + } + }; + + return ''; +} + scriptargtype + 1 + scriptfile + + type + 7 + + type + alfred.workflow.action.script + uid + 5AC036FB-A3C0-436B-B7C7-C0B233864760 + version + 2 + + + config + + conditions + + + inputstring + {query} + matchcasesensitive + + matchmode + 1 + matchstring + + outputlabel + write + uid + ACA65CAA-E8A3-4440-A5AB-26CE32690934 + + + elselabel + noop + hideelse + + + type + alfred.workflow.utility.conditional + uid + E1FA3357-9FCA-40A0-95E5-DE3528FC1F62 + version + 1 + + + config + + type + 0 + + type + alfred.workflow.utility.transform + uid + 638D60CD-3905-4F5D-869E-B1561A989818 + version + 1 + + + readme + + uidata + + 07462418-C42F-4168-B2C5-BFC05E6997EA + + xpos + 795 + ypos + 795 + + 128CDF67-6A8F-4993-B5CC-492CFC101AC4 + + note + Add item + xpos + 35 + ypos + 40 + + 234CC09E-2B28-4152-BE00-1104084F6E31 + + colorindex + 5 + xpos + 700 + ypos + 455 + + 248951AF-CC02-4C99-8B83-C076BA1F7165 + + xpos + 1095 + ypos + 810 + + 2A7F4EEC-9CDA-415D-8D94-840326F56446 + + xpos + 390 + ypos + 40 + + 2ED2B2E9-BACA-49D5-86A5-8E6EE62991AF + + note + Get item + xpos + 420 + ypos + 255 + + 3F37DA32-7CB6-4BE9-9087-0C8693D5BE39 + + colorindex + 2 + xpos + 1095 + ypos + 925 + + 446F8E5A-D2C9-4E82-B811-489F83D6107F + + xpos + 215 + ypos + 455 + + 4E2B0C6B-5409-40E2-B596-462E5FC927A9 + + xpos + 535 + ypos + 70 + + 4FA59109-6D15-4646-B276-0173CC8E24C2 + + xpos + 620 + ypos + 285 + + 55536DCF-62A7-4E8C-8196-910B271432E1 + + xpos + 460 + ypos + 485 + + 5AC036FB-A3C0-436B-B7C7-C0B233864760 + + xpos + 795 + ypos + 940 + + 5C434A4E-AE0D-4AC3-903B-DC57FD94E82A + + xpos + 530 + ypos + 455 + + 638D60CD-3905-4F5D-869E-B1561A989818 + + xpos + 945 + ypos + 970 + + 7184DE64-72F9-40F5-ABE4-2D65C3441ED1 + + xpos + 215 + ypos + 515 + + 77770747-4764-4364-9CC0-0204384A925A + + note + Read first item + xpos + 35 + ypos + 255 + + 8C10DDB1-AF6C-4DC0-A8A9-98AFBD5B8108 + + colorindex + 2 + xpos + 600 + ypos + 40 + + 8C5FCB86-BC89-462E-949F-DFA50BC684BB + + colorindex + 5 + xpos + 710 + ypos + 255 + + 940281B8-B904-4115-ABC3-F6BF9F68EC2F + + xpos + 570 + ypos + 285 + + 96F2DB4E-9135-43AC-8A32-92DD15BB6693 + + xpos + 945 + ypos + 825 + + 97622ECB-E7D8-4A7F-8D24-01E8E35780F2 + + xpos + 315 + ypos + 455 + + A013A9B4-3B19-4889-A859-092BEB536969 + + colorindex + 5 + xpos + 600 + ypos + 795 + + A4DDA684-56D3-4574-BBB5-2EFA23A4F1CE + + xpos + 1015 + ypos + 815 + + ADB99D1F-284A-4D23-A3C2-AD058AA42882 + + note + Show reading list + xpos + 35 + ypos + 455 + + BB31A2CF-BA2D-49D4-9ECD-9305F75C4693 + + xpos + 355 + ypos + 285 + + D9D455FA-C126-49F4-833E-D2DCB965CE42 + + xpos + 210 + ypos + 255 + + E1FA3357-9FCA-40A0-95E5-DE3528FC1F62 + + xpos + 1015 + ypos + 960 + + E8BADEFB-E178-4BE6-B35A-F2A5A9A1EF17 + + xpos + 1095 + ypos + 695 + + + userconfigurationconfig + + + config + + default + + filtermode + 2 + placeholder + + required + + + description + + label + Reading list Markdown file + type + filepicker + variable + file_path + + + version + + webaddress + http://colomolome.com + + diff --git a/read.png b/read.png new file mode 100644 index 0000000..70e32d9 Binary files /dev/null and b/read.png differ diff --git a/unread.png b/unread.png new file mode 100644 index 0000000..76ff3f9 Binary files /dev/null and b/unread.png differ