Feat: Help options
This commit is contained in:
parent
a4e443d946
commit
3b675b0da0
16
avds
16
avds
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
USAGE="
|
||||
USAGE: avds <mod_list> [<when>] [<repeat>]
|
||||
USAGE: avds <mod_list|-h|-[-]help> [<when>] [<repeat>]
|
||||
|
||||
mod_list
|
||||
A comma or space separated list of modules to request that
|
||||
@ -19,6 +19,12 @@ USAGE: avds <mod_list> [<when>] [<repeat>]
|
||||
|
||||
EXAMPLES:
|
||||
|
||||
Any of these will display this help message.
|
||||
|
||||
avds -h
|
||||
avds -help
|
||||
avds --help
|
||||
|
||||
If there are volume and backlight modules named 'vol' and 'bl' that
|
||||
update the volume and backlight statuses, send a requst to update
|
||||
both of those statuses immediately.
|
||||
@ -52,6 +58,14 @@ if [[ "$#" -lt 1 || "$#" -gt 3 ]]; then
|
||||
fi
|
||||
|
||||
IFS=', ' read -r -a mods <<< "$1"
|
||||
|
||||
# Check if the user needs help
|
||||
# shellcheck disable=SC2128
|
||||
if [[ "${mods}" =~ ^(-h|-(-)?help)$ ]]; then
|
||||
printf '%s' "${USAGE}" 1>&2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
when="${2:-0}"
|
||||
repeat="$3"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user