diff options
author | Guangxiong Lin <[email protected]> | 2022-11-20 23:14:08 +0800 |
---|---|---|
committer | Guangxiong Lin <[email protected]> | 2022-11-20 23:47:11 +0800 |
commit | c9ea66f4d1b162d86bb4c1a5fc285c6d95500330 (patch) | |
tree | 019ae12678a4c967fc48cde2cc3feb6a2a145806 | |
parent | ac8791df68c515a57be4696d70ed382fe31a37d0 (diff) | |
download | wd-c9ea66f4d1b162d86bb4c1a5fc285c6d95500330.tar.gz wd-c9ea66f4d1b162d86bb4c1a5fc285c6d95500330.tar.bz2 wd-c9ea66f4d1b162d86bb4c1a5fc285c6d95500330.zip |
Enhance edit command
It can now edit not only index.md
-rwxr-xr-x | wd | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -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_INDEX_FILE=${WD_INDEX_FILE:-index.md} WD_DEFAULT_SUBCOMMAND=${WD_DEFAULT_SUBCOMMAND:-help} year=$(date +%Y) @@ -31,7 +32,14 @@ cmd_version () { } cmd_edit () { - $EDITOR "$WD_NOTES_DIR/index.md" + local file + if [ "$#" -eq 0 ]; then + file="$WD_INDEX_FILE" + else + file="$1" + fi + + $EDITOR "$WD_NOTES_DIR/$file" exit 0 } |