Merge branches 'fix/broken-action-symlink' and 'refactor/shellquote'

This commit is contained in:
Ingo Karkat
2022-04-12 08:17:01 +02:00
3 changed files with 9 additions and 9 deletions

View File

@@ -10,7 +10,7 @@ jobs:
test: test:
strategy: strategy:
matrix: 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 }} runs-on: ${{ matrix.platform }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2

View File

@@ -23,7 +23,12 @@ Download the latest stable [release][release] for use on your desktop or server.
```shell ```shell
brew install todo-txt brew install todo-txt
# For macOS on x86 CPU
cp -n /usr/local/opt/todo-txt/todo.cfg ~/.todo.cfg 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. **Note**: The `-n` flag for `cp` makes sure you do not overwrite an existing file.

11
todo.sh
View File

@@ -824,11 +824,6 @@ _addto() {
fi fi
} }
shellquote()
{
typeset -r qq=\'; printf %s\\n "'${1//\'/${qq}\\${qq}${qq}}'";
}
filtercommand() filtercommand()
{ {
filter=${1:-} filter=${1:-}
@@ -843,13 +838,13 @@ filtercommand()
then then
## First character isn't a dash: hide lines that don't match ## First character isn't a dash: hide lines that don't match
## this $search_term ## this $search_term
filter="${filter:-}${filter:+ | }grep -i $(shellquote "$search_term")" printf -v filter '%sgrep -i %q' "${filter:-}${filter:+ | }" "$search_term"
else else
## First character is a dash: hide lines that match this ## First character is a dash: hide lines that match this
## $search_term ## $search_term
# #
## Remove the first character (-) before adding to our filter command ## 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 fi
done done
@@ -1047,7 +1042,7 @@ hasCustomAction()
return 1 return 1
} }
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 == # == HANDLE ACTION ==
action=$( printf "%s\n" "$ACTION" | tr '[:upper:]' '[:lower:]' ) action=$( printf "%s\n" "$ACTION" | tr '[:upper:]' '[:lower:]' )