aboutsummaryrefslogtreecommitdiff
path: root/core/help
diff options
context:
space:
mode:
Diffstat (limited to 'core/help')
-rwxr-xr-xcore/help37
1 files changed, 37 insertions, 0 deletions
diff --git a/core/help b/core/help
new file mode 100755
index 0000000..98abd1e
--- /dev/null
+++ b/core/help
@@ -0,0 +1,37 @@
+#!/bin/sh
+[ "$1" = "info" ] && echo "show this very message" && exit 2
+
+cat << EOF
+$progname -- daemonless posix pomodoro timer
+
+usage:
+ $progname [options] [action] [action options]
+
+options:
+ -h, --help show help
+
+actions:
+EOF
+
+IFS=':'
+find $path -type l,f -perm /u=x,g=x,o=x 2>/dev/null | while read -r action ; do
+ action_name="$(basename "$action")"
+ if [ -L "$action" ] ; then
+ printf '%s\t%s\n' "$action_name" "same as $(basename "$(readlink -f "$action")")"
+ else
+ action_info="$("$action" info)"
+ [ $? -eq 2 ] && printf '%s\t%s\n' "$action_name" "$action_info"
+ fi
+done | awk '
+ BEGIN { FS = "\t" }
+ {
+ if (printed[$1]) next
+ printf("\t%-13s %s\n", $1, $2)
+ printed[$1] = 1
+ }
+'
+
+cat << EOF
+
+if no action is provided, the \`state\` action is chosen by default
+EOF