From 3185956a742629b98e70dc793169a417bdf3bf8c Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 26 Dec 2014 00:53:56 +0900 Subject: [PATCH] setup.sh: Add help subcommand --- setup.sh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/setup.sh b/setup.sh index 55bfebf..ef6750c 100755 --- a/setup.sh +++ b/setup.sh @@ -470,21 +470,32 @@ setup_env(){ ######################### -# main +# help and main + +help(){ + echo "Usage: ./setup.sh ..." + echo " or: ./setup.sh help" + echo "Available cmds are: $__setups" +} main(){ detect_systems if test -z "$1" then - echo "Usage: ./setup.sh ..." - echo "Available cmds are: $__setups" - exit 1 + help + return 1 fi _cmd=$1 shift + if test "$_cmd" = help + then + help + return 0 + fi + _msg Running setup_$_cmd setup_$_cmd "$@" _msg Running setup_$_cmd done