diff options
author | Guangxiong Lin <[email protected]> | 2022-11-20 23:47:26 +0800 |
---|---|---|
committer | Guangxiong Lin <[email protected]> | 2022-11-20 23:47:26 +0800 |
commit | f58eb61d80dfc39e4ed33ca0680bd92736d4b452 (patch) | |
tree | d574d691fde6eba7541108fc1347b410f38d618c | |
parent | c9ea66f4d1b162d86bb4c1a5fc285c6d95500330 (diff) | |
download | wd-f58eb61d80dfc39e4ed33ca0680bd92736d4b452.tar.gz wd-f58eb61d80dfc39e4ed33ca0680bd92736d4b452.tar.bz2 wd-f58eb61d80dfc39e4ed33ca0680bd92736d4b452.zip |
Improve default subcommand implementation
-rwxr-xr-x | wd | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -78,12 +78,11 @@ cmd_git () { cd "$WD_NOTES_DIR" && git "$@" } -if [ "$#" -eq 0 ]; then - "$PROGRAM" "$WD_DEFAULT_SUBCOMMAND" - exit 0 -fi -case "$1" in +subcommand="$WD_DEFAULT_SUBCOMMAND" +[ "$#" -ne 0 ] && subcommand="$1" + +case "$subcommand" in help|--help|-h) shift; cmd_usage "$@";; version|--version|-v) shift; cmd_version "$@";; journal|j) shift; cmd_journal "$@";; |