blob: 4bc54967b456b13bec9dd0d0f98b9ac4f7ce74fd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#!/bin/sh
[ "$1" = "info" ] && echo "show help" && 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
|