Add "help" command (#3)

This commit is contained in:
Ivan R. 2023-02-16 23:43:26 +05:00
parent 15cd361121
commit 90a0fe61d3
No known key found for this signature in database
GPG key ID: 56C7BAAE859B302C

View file

@ -42,6 +42,16 @@ function merge {
find $BASE_DIR -type f -name "*.md" -exec echo "# {}" \; -exec cat "{}" \; -exec echo \; find $BASE_DIR -type f -name "*.md" -exec echo "# {}" \; -exec cat "{}" \; -exec echo \;
} }
function help {
echo "Histd - How I Spent This Day"
echo "A simple personal diary app"
echo
echo "Usage:"
echo "- histd.sh - open a text editor to describe the current day"
echo "- histd.sh backup - create an archive of all notes"
echo "- histd.sh merge - print all notes"
echo "- histd.sh help - show this message"
}
# Prepare the environment # Prepare the environment
BASE_DIR=~/.local/share/histd BASE_DIR=~/.local/share/histd
@ -54,6 +64,10 @@ elif [[ $1 == "backup" ]]; then
backup backup
elif [[ $1 == "merge" ]]; then elif [[ $1 == "merge" ]]; then
merge merge
elif [[ $1 == "help" ]]; then
help
else else
echo Command not found echo Command not found
echo
help
fi fi