From 2d70a0aadfca885ec49c734ab56d19cd1224ff31 Mon Sep 17 00:00:00 2001 From: a1346054 <36859588+a1346054@users.noreply.github.com> Date: Mon, 9 Aug 2021 20:03:49 +0000 Subject: [PATCH] Minor fixes identified through shellcheck and other tools (#350) * fix whitespace * fix spelling * fix whitespace * unify headers of tests * fix some issues in tests, identified by shellcheck * fix bash completions bash completion files are not supposed to be executable * fix some issues identified by shellcheck Co-authored-by: Ali Karbassi --- CHANGELOG.md | 4 +- GEN-VERSION-FILE | 2 - LICENSE | 2 +- Makefile | 2 +- README.md | 4 +- USAGE.md | 10 +-- tests/README | 64 +++++++++---------- tests/actions-test-lib.sh | 2 +- tests/aggregate-results.sh | 12 ++-- tests/t0000-config.sh | 6 +- tests/t0001-null.sh | 1 - tests/t0002-actions.sh | 4 +- tests/t1020-addtolistfile.sh | 4 +- tests/t1100-replace.sh | 4 +- tests/t1300-ls.sh | 2 - tests/t1310-listcon.sh | 1 - tests/t1320-listproj.sh | 2 - tests/t1330-ls-highlighting.sh | 1 - tests/t1340-listescapes.sh | 1 - .../t1360-ls-project-context-highlighting.sh | 1 - ...80-ls-date-number-metadata-highlighting.sh | 2 - tests/t1500-do.sh | 1 + tests/t1600-append.sh | 2 +- tests/t1850-move.sh | 1 - tests/t2100-help.sh | 1 - tests/t2120-shorthelp.sh | 2 - tests/t2200-no-done-report-files.sh | 3 +- tests/t6000-completion.sh | 1 - tests/t6010-completion-contexts.sh | 1 - tests/t6020-completion-projects.sh | 1 - tests/t6030-completion-tasks.sh | 1 - tests/t6040-completion-files.sh | 1 - tests/t6050-completion-addons.sh | 3 +- tests/t6060-completion-addon-files.sh | 1 - tests/t6080-completion-path.sh | 3 - tests/t6090-completion-aliases.sh | 2 - tests/t6100-completion-help.sh | 1 - tests/test-lib.sh | 30 ++++----- todo.sh | 13 ++-- todo_completion | 8 ++- 40 files changed, 88 insertions(+), 119 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dde4cee..e10522b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -147,7 +147,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Changed - Changed odd tabs to spaces. -- Faster help/useage document outputs. +- Faster help/usage document outputs. - Consolidated `TODOTXT_VERBOSE` tests. - Refactored various add functionality to one function. - Updated `_list()` output to match updated `addto`. @@ -436,7 +436,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Added -- `list` is case insenstive. ie, `todo list Mac` will match lines with "mac" and "Mac" +- `list` is case insensitive. ie, `todo list Mac` will match lines with "mac" and "Mac" ### Changed diff --git a/GEN-VERSION-FILE b/GEN-VERSION-FILE index 7821d60..6308d3e 100755 --- a/GEN-VERSION-FILE +++ b/GEN-VERSION-FILE @@ -34,5 +34,3 @@ test "$VN" = "$VC" || { echo >&2 "VERSION=$VN" echo "VERSION=$VN" >$VF } - - diff --git a/LICENSE b/LICENSE index e72bfdd..f288702 100644 --- a/LICENSE +++ b/LICENSE @@ -671,4 +671,4 @@ into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read -. \ No newline at end of file +. diff --git a/Makefile b/Makefile index 58c1e69..b6056bc 100644 --- a/Makefile +++ b/Makefile @@ -98,7 +98,7 @@ $(TESTS): test-pre-clean test: aggregate-results tests/aggregate-results.sh tests/test-results/t*-* rm -rf tests/test-results - + # Force tests to get run every time .PHONY: test test-pre-clean aggregate-results $(TESTS) diff --git a/README.md b/README.md index af1fc36..4fc5128 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ See [CHANGELOG.md][CHANGELOG] ## Contributing -We welcome all contributations. First read our [Contributor Code of Conduct][CODE_OF_CONDUCT] and then get started [contributing][CONTRIBUTING]. +We welcome all contributions. First read our [Contributor Code of Conduct][CODE_OF_CONDUCT] and then get started [contributing][CONTRIBUTING]. ## License @@ -94,7 +94,7 @@ GNU General Public License v3.0 © [todo.txt org][github] [release]: https://github.com/todotxt/todo.txt-cli/releases -[website]: http://todotxt.org +[website]: http://todotxt.org/ [github]: https://github.com/todotxt [USAGE]: ./USAGE.md [CHANGELOG]: ./CHANGELOG.md diff --git a/USAGE.md b/USAGE.md index 3db9094..4500377 100644 --- a/USAGE.md +++ b/USAGE.md @@ -7,9 +7,9 @@ todo.sh [-fhpantvV] [-d todo_config] action [task_number] [task_description] ## Actions ### `add` -Adds THING I NEED TO DO to your todo.txt file on its own line. +Adds THING I NEED TO DO to your todo.txt file on its own line. -Project and context notation optional. +Project and context notation optional. Quotes optional. @@ -28,7 +28,7 @@ todo.sh addm "FIRST THING I NEED TO DO +project1 @context SECOND THING I NEED TO DO +project2 @context" ``` -### `addto` +### `addto` Adds a line of text to any file located in the todo.txt directory. For example, `addto inbox.txt "decide about vacation"` @@ -101,10 +101,10 @@ todo.sh help [ACTION...] ``` ### `list` -Displays all tasks that contain TERM(s) sorted by priority with line numbers. Each task must match all TERM(s) (logical AND); to display tasks that contain any TERM (logical OR), use `"TERM1\|TERM2\|..."` (with quotes), or `TERM1\\|TERM2` (unquoted). Hides all tasks that contain TERM(s) preceded by a minus sign (i.e. `-TERM`). +Displays all tasks that contain TERM(s) sorted by priority with line numbers. Each task must match all TERM(s) (logical AND); to display tasks that contain any TERM (logical OR), use `"TERM1\|TERM2\|..."` (with quotes), or `TERM1\\|TERM2` (unquoted). Hides all tasks that contain TERM(s) preceded by a minus sign (i.e. `-TERM`). If no TERM specified, lists entire todo.txt. -​ + ```shell todo.sh list [TERM...] todo.sh ls [TERM...] diff --git a/tests/README b/tests/README index d5fc70a..3f1740d 100644 --- a/tests/README +++ b/tests/README @@ -18,14 +18,14 @@ The easiest way to run tests is to say "make test" from the top-level. This runs all the tests. rm -rf tests/test-results "tests/trash directory"* - cd tests && sh t0000-config.sh + cd tests && sh t0000-config.sh * ok 1: no config file * ok 2: config file (default location 1) * ok 3: config file (default location 2) * ok 4: config file (command line) * ok 5: config file (env variable) * passed all 5 test(s) - cd tests && sh t0001-null.sh + cd tests && sh t0001-null.sh * ok 1: null ls * passed all 1 test(s) rm -rf tests/test-results @@ -33,7 +33,7 @@ This runs all the tests. Or you can run each test individually from command line, like this: - $ ./t0001-null.sh + $ ./t0001-null.sh * ok 1: null ls * passed all 1 test(s) @@ -42,27 +42,27 @@ You can pass --verbose (or -v), --debug (or -d), and --immediate appropriately before running "make". --verbose:: - This makes the test more verbose. Specifically, the - command being run and their output if any are also - output. + This makes the test more verbose. Specifically, the + command being run and their output if any are also + output. --debug:: - This may help the person who is developing a new test. - It causes the command defined with test_debug to run. + This may help the person who is developing a new test. + It causes the command defined with test_debug to run. --immediate:: - This causes the test to immediately exit upon the first - failed test. + This causes the test to immediately exit upon the first + failed test. --long-tests:: - This causes additional long-running tests to be run (where - available), for more exhaustive testing. + This causes additional long-running tests to be run (where + available), for more exhaustive testing. --tee:: - In addition to printing the test output to the terminal, - write it to files named 't/test-results/$TEST_NAME.out'. - As the names depend on the tests' file names, it is safe to - run the tests with this option in parallel. + In addition to printing the test output to the terminal, + write it to files named 't/test-results/$TEST_NAME.out'. + As the names depend on the tests' file names, it is safe to + run the tests with this option in parallel. Skipping Tests -------------- @@ -97,15 +97,15 @@ Naming Tests The test files are named as: - tNNNN-commandname-details.sh + tNNNN-commandname-details.sh where N is a decimal digit. First digit tells the family: - 0 - the absolute basics and global stuff - 1 - basic every-day usage - 2 - add ins + 0 - the absolute basics and global stuff + 1 - basic every-day usage + 2 - add ins Second digit tells the particular command we are testing. @@ -128,15 +128,15 @@ The test script is written as a shell script. It should start with the standard "#!/bin/bash" with copyright notices, and an assignment to variable 'test_description', like this: - #!/bin/bash - # - # Copyright (c) 2005 Junio C Hamano - # + #!/bin/bash + # + # Copyright (c) 2005 Junio C Hamano + # - test_description='xxx test (option --frotz) + test_description='xxx test (option --frotz) - This test registers the following structure in the cache - and tries to run git-ls-files with option --frotz.' + This test registers the following structure in the cache + and tries to run git-ls-files with option --frotz.' Source 'test-lib.sh' @@ -145,7 +145,7 @@ Source 'test-lib.sh' After assigning test_description, the test script should source test-lib.sh like this: - . ./test-lib.sh + . ./test-lib.sh This test harness library does the following things: @@ -219,9 +219,9 @@ library for your script to use. Example: - test_expect_success \ - 'git-write-tree should be able to write an empty tree.' \ - 'tree=$(git-write-tree)' + test_expect_success \ + 'git-write-tree should be able to write an empty tree.' \ + 'tree=$(git-write-tree)' - test_expect_code