commit: b0a0b56072536d109e86857aa22a8bf31f0737ae
parent: 00c3c84f9e2ef192f012815d26e90fe66e89380b
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Thu, 16 Aug 2018 01:02:49 +0200
Add list and show commands
list: ls on the moods directory
show: show today mood file in a PAGER
(fallbacks to more if PAGER isn’t defined)
Diffstat:
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
@@ -6,10 +6,12 @@ A mood-tracker in POSIX Shell Script.
Please modify ``moods_dir`` and ``git_auto_push`` into ``mood`` to the appropriate values for your usage.
```
-Usage: mood [new mood_description|check]
+Usage: mood [new mood_description|check|show|list]
Subcommands:
new: inserts a new mood
check: Reminds you to input your daily mood if not done
+ show: show the mood(s) of the day
+ list: list the mood(s) files
```
## Dependencies
diff --git a/mood b/mood
@@ -50,10 +50,12 @@ mood_check() {
mood_usage() {
cat >&2 <<EOF
-Usage: ${1} [new mood_description|check]
+Usage: ${1} [new mood_description|check|show|list]
Subcommands:
new: inserts a new mood
check: Reminds you to input your daily mood if not done
+ show: show the mood(s) of the day
+ list: list the mood(s) files
EOF
}
@@ -64,6 +66,12 @@ case $1 in
'check')
mood_check
;;
+ 'show')
+ ${PAGER:-more} "${moods_dir}/${date}.log"
+ ;;
+ 'list')
+ ls "${moods_dir}"
+ ;;
*)
mood_usage $0
exit 1