Add usage help
[khome.git] / home / bin / wallpaper_review
index b466255..8b15bcb 100755 (executable)
@@ -109,7 +109,7 @@ paths_preview() {
                 (( i = (i + 1) % n ));;
             CMD_FAVORITE_ADD)
                 printf 'Adding to favorites set: "%s"\n' "$path" >&2
-                wallpaper_fav;;
+                wallpaper_fav "$path";;
             CMD_FAVORITE_REMOVE)
                 printf 'Removing from favorites set: "%s"\n' "$path" >&2
                 digest=$(sha256sum "$path" | awk '{print $1}')
@@ -134,18 +134,57 @@ paths_preview() {
     done
 }
 
+help_print() {
+    cat <<EOF >&2
+
+Navigation help:
+
+key | action
+----+----------------------------------------------
+ q  |  quit
+ h  |  move back
+ l  |  move forward
+ f  |  add to favorites
+ r  |  remove from favorites
+ s  |  set current
+ z  |  fuzzy search for next file path
+ :N |  goto Nth image
+----+----------------------------------------------
+
+EOF
+}
+
+usage() {
+    cat <<EOF >&2
+
+$(basename "$0") [cmd]
+
+cmd | args  | meaning
+----+-------+------------------------------------------------
+ f  |       | favorites
+ d  | <dir> | from given dir
+ a  |       | all from $DIR_WALLPAPERS <- DEFAULT if no cmd.
+ h  |       | usage help. i.e. this message.
+----+-------+------------------------------------------------
+
+EOF
+}
+
 main() {
     case "$1" in
         f | fav) paths_set_from_favs;;
         d | dir) paths_set_from_dir_find "$2";;
         a | all) paths_set_from_dir_find "$DIR_WALLPAPERS";;
+        h | -h | help | -help | --help)
+            usage;
+            exit 1;;
         '')
             paths_set_from_dir_find "$DIR_WALLPAPERS";;
         *)
             printf 'Error: unknown source "%s"\n' "$1" >&2
             exit 1;;
     esac
-
+    help_print
     paths_preview
 }
 
This page took 0.029204 seconds and 4 git commands to generate.