[Intel-gfx] [maintainer-tools PATCH v2 33/33] dim: add -h option for usage, imrove output on unknown options
Jani Nikula
jani.nikula at intel.com
Thu Jan 28 05:27:27 PST 2016
Show usage also with the -h option, and improve output on unknown
options.
Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
dim | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/dim b/dim
index 1651b5e8218a..fe1b2e8f1bad 100755
--- a/dim
+++ b/dim
@@ -107,6 +107,7 @@ DRY_RUN=
INTERACTIVE=
DRY=
FORCE=
+HELP=
function warn_or_fail
{
@@ -118,7 +119,7 @@ function warn_or_fail
fi
}
-while getopts dfi opt; do
+while getopts hdfi opt; do
case "$opt" in
d)
DRY_RUN=--dry-run
@@ -130,15 +131,18 @@ while getopts dfi opt; do
i)
INTERACTIVE='eval read -rsp "Press any key to continue..." -n1 key2; echo'
;;
+ h)
+ HELP=1
+ ;;
*)
- echo "Try 'dim help' for more information. $opt"
+ echo "See '$0 help' for more information." >&2
exit
esac
done
shift `expr $OPTIND - 1`
# first positional argument is the subcommand
-if [ "$#" = "0" ]; then
+if [ -n "$HELP" -o "$#" = "0" ]; then
subcommand="usage"
else
subcommand="$1"
--
2.1.4
More information about the Intel-gfx
mailing list