-
Notifications
You must be signed in to change notification settings - Fork 714
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH: Enable file completion for add-on actions via _todo_file{1,2,3}_…
…actions (#270) * Refactoring: Use regular expression match instead of case globbing for actions taking a SRC argument Making it consistent with the test for MOVE_COMMAND_PATTERN, and allowing to extend the pattern with custom actions in the future. * Refactoring: Move the anchoring and grouping out of MOVE_COMMAND_PATTERN So that additional (custom) add-on actions can be configured in the future. * ENH: Enable file completion for add-on actions via _todo_file{1,2,3}_actions Allowing completion of todo files directly after the add-on action (1), with one (2) / two (3) arguments in between. This should handle most cases. In order to configure the add-on completion, the corresponding configuration variable has to be defined in the user's shell (e.g. via ~/.bashrc): _todo_file1_actions='myaction|anotheraction'
- Loading branch information
Showing
2 changed files
with
82 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
# | ||
|
||
test_description='Bash add-on action file completion functionality | ||
This test checks todo_completion of files for add-on actions that have file argument(s) configured | ||
' | ||
. ./test-lib.sh | ||
|
||
readonly FILES='done.txt report.txt todo.txt' | ||
test_todo_completion 'nothing after unconfigured bar' 'todo.sh bar ' '' | ||
|
||
_todo_file1_actions='foo|bar' | ||
test_todo_completion 'all files after configured bar' 'todo.sh bar ' "$FILES" | ||
test_todo_completion 'nothing after configured bar ITEM#' 'todo.sh bar 1 ' '' | ||
|
||
_todo_file2_actions='baz' | ||
test_todo_completion 'nothing after configured baz' 'todo.sh baz ' '' | ||
test_todo_completion 'all files after configured baz ITEM#' 'todo.sh baz 1 ' "$FILES" | ||
test_todo_completion 'nothing after configured baz ITEM# MORE' 'todo.sh baz 1 more ' '' | ||
|
||
_todo_file3_actions='biz' | ||
test_todo_completion 'nothing after configured biz' 'todo.sh biz ' '' | ||
test_todo_completion 'nothing after configured biz ITEM#' 'todo.sh biz 1 ' '' | ||
test_todo_completion 'all files after configured biz ITEM# MORE' 'todo.sh biz 1 more ' "$FILES" | ||
test_todo_completion 'nothing after configured biz ITEM# EVEN MORE' 'todo.sh biz 1 even more ' '' | ||
|
||
test_done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters