diff options
author | lonkaars <loek@pipeframe.xyz> | 2024-03-11 18:33:02 +0100 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2024-03-11 18:33:02 +0100 |
commit | e6c1cacb60010ec75e02cf72acf34278417670fd (patch) | |
tree | 97e8f8042f4d8461e7cec9f403787bad20ffde9e /core/help |
initial commit (basic functionality)
Diffstat (limited to 'core/help')
-rwxr-xr-x | core/help | 37 |
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 |