From d0075e4d578422f6a7143026b8b906eed0bc4a97 Mon Sep 17 00:00:00 2001 From: Lawrence Liu Date: Fri, 19 Nov 2021 21:48:16 +0800 Subject: [PATCH 1/3] Different folder to copy ~/.todo.cfg for macOS on arm/x86 CPU (#369) --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 4fc5128..925afc8 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,12 @@ Download the latest stable [release][release] for use on your desktop or server. ```shell brew install todo-txt + +# For macOS on x86 CPU cp -n /usr/local/opt/todo-txt/todo.cfg ~/.todo.cfg + +# For macOS on arm CPU +cp -n /opt/homebrew/opt/todo-txt/todo.cfg ~/.todo.cfg ``` **Note**: The `-n` flag for `cp` makes sure you do not overwrite an existing file. From ea32af34e6a0efef59bdf9acaa1c38d5d32bef0d Mon Sep 17 00:00:00 2001 From: Ali Karbassi Date: Thu, 2 Dec 2021 15:49:42 -0600 Subject: [PATCH 2/3] Updated GitHub Actions Environments (#372) Rather than `*-latest`, I'm specifying specific environments. --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index eeea980..27fbeb5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,7 +10,7 @@ jobs: test: strategy: matrix: - platform: [ubuntu-latest, macos-latest, ubuntu-18.04] + platform: [ubuntu-20.04, ubuntu-18.04, macos-11, macos-10.15] runs-on: ${{ matrix.platform }} steps: - uses: actions/checkout@v2 From aef7d8b9e580b13d58e39a37f139803f207c464f Mon Sep 17 00:00:00 2001 From: Ingo Karkat Date: Tue, 12 Apr 2022 07:53:07 +0200 Subject: [PATCH 3/3] Refactoring: Replace shellquote() with printf %q I didn't know about printf's capability when I introduced quoting 10 years ago. The %q format will do the quoting, and "-v VAR" can be used to reassign to the variable. Note: The shellquote() function has been exported for reuse by add-ons. I don't think anyone has ever used that (it was mostly intended for my own, extensive extensions, and I never used it), and is trivial to move away from, anyway. --- todo.sh | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/todo.sh b/todo.sh index fb8d4bc..d084d58 100755 --- a/todo.sh +++ b/todo.sh @@ -824,11 +824,6 @@ _addto() { fi } -shellquote() -{ - typeset -r qq=\'; printf %s\\n "'${1//\'/${qq}\\${qq}${qq}}'"; -} - filtercommand() { filter=${1:-} @@ -843,13 +838,13 @@ filtercommand() then ## First character isn't a dash: hide lines that don't match ## this $search_term - filter="${filter:-}${filter:+ | }grep -i $(shellquote "$search_term")" + printf -v filter '%sgrep -i %q' "${filter:-}${filter:+ | }" "$search_term" else ## First character is a dash: hide lines that match this ## $search_term # ## Remove the first character (-) before adding to our filter command - filter="${filter:-}${filter:+ | }grep -v -i $(shellquote "${search_term:1}")" + printf -v filter '%sgrep -v -i %q' "${filter:-}${filter:+ | }" "${search_term:1}" fi done @@ -1036,7 +1031,7 @@ listWordsWithSigil() | sort -u } -export -f cleaninput getPrefix getTodo getNewtodo shellquote filtercommand _list listWordsWithSigil getPadding _format die +export -f cleaninput getPrefix getTodo getNewtodo filtercommand _list listWordsWithSigil getPadding _format die # == HANDLE ACTION == action=$( printf "%s\n" "$ACTION" | tr '[:upper:]' '[:lower:]' )