-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvm-command-help.in
executable file
·54 lines (43 loc) · 990 Bytes
/
vm-command-help.in
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh -efu
[ -z "@MKLOCAL@" ] ||
export PATH="@PREFIX@/libshell:${PATH#@PREFIX@/libshell:}"
case "${VM_HELP-}" in
USAGE)
printf 'help <command>\n'
;;
SUMMARY)
printf 'Displays help information about <command>\n'
;;
DESCRIPTION)
;;
OPTIONS)
;;
esac
[ -z "${VM_HELP-}" ] ||
exit 0
[ "$#" -gt 0 ] ||
show_help
[ "$#" -lt 2 ] ||
show_usage "Too many arguments"
command="$1"
shift
[ -x "@PREFIX@/vm-command-$command" ] ||
fatal "Unknown command: $command"
prefix='Usage'
VM_HELP=USAGE "@PREFIX@/vm-command-$command" |
while read -r m; do
printf '%s: %s %s\n' "$prefix" "$PROG" "$m"
prefix=' or'
done
printf '\n'
desc="$(VM_HELP=DESCRIPTION "@PREFIX@/vm-command-$command")"
[ -n "$desc" ] ||
desc="$(VM_HELP=SUMMARY "@PREFIX@/vm-command-$command")."
printf '%s\n' "$desc"
printf '\n'
opts="$(VM_HELP=OPTIONS "@PREFIX@/vm-command-$command")"
if [ -n "$opts" ]; then
printf 'Options:\n'
printf '%s\n\n' "$opts"
fi
printf '%s\n\n' "Report bugs to author."