summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuangxiong Lin <[email protected]>2022-11-20 23:12:30 +0800
committerGuangxiong Lin <[email protected]>2022-11-20 23:12:30 +0800
commitac8791df68c515a57be4696d70ed382fe31a37d0 (patch)
treed0ec43537c6c02cb92ca7eddb25851d3e7ad6b86
parentec1a3a87f9e8eb48c81ea35c0ec35c3fe3c71386 (diff)
downloadwd-ac8791df68c515a57be4696d70ed382fe31a37d0.tar.gz
wd-ac8791df68c515a57be4696d70ed382fe31a37d0.tar.bz2
wd-ac8791df68c515a57be4696d70ed382fe31a37d0.zip
Support default command
-rwxr-xr-xwd6
1 files changed, 6 insertions, 0 deletions
diff --git a/wd b/wd
index 9a76b1e..1a2e1f2 100755
--- a/wd
+++ b/wd
@@ -7,6 +7,7 @@ PROGRAM="$(basename $0)"
WD_NOTES_DIR=${WD_NOTES_DIR:-"$HOME/notes"}
WD_JOURNALS_DIR=${WD_JOURNALS_DIR:-"$WD_NOTES_DIR/journals"}
+WD_DEFAULT_SUBCOMMAND=${WD_DEFAULT_SUBCOMMAND:-help}
year=$(date +%Y)
week_number=$(date +%W)
@@ -69,6 +70,11 @@ cmd_git () {
cd "$WD_NOTES_DIR" && git "$@"
}
+if [ "$#" -eq 0 ]; then
+ "$PROGRAM" "$WD_DEFAULT_SUBCOMMAND"
+ exit 0
+fi
+
case "$1" in
help|--help|-h) shift; cmd_usage "$@";;
version|--version|-v) shift; cmd_version "$@";;