From 3b675b0da04a336c6ca557c36de0cfedd464e858 Mon Sep 17 00:00:00 2001 From: Narvin Singh Date: Fri, 1 Jan 2021 23:47:30 -0500 Subject: [PATCH] Feat: Help options --- avds | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/avds b/avds index 0a914e5..0685a4f 100755 --- a/avds +++ b/avds @@ -1,7 +1,7 @@ #!/bin/bash USAGE=" -USAGE: avds [] [] +USAGE: avds [] [] mod_list A comma or space separated list of modules to request that @@ -19,6 +19,12 @@ USAGE: avds [] [] 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"