From: Adrian Glaubitz Date: Sat, 5 Dec 2009 17:05:10 +0000 (-0500) Subject: [set-default-theme] Add --help option X-Git-Tag: 0.8.0~86 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d6358fc4f69fb00d2909a80f7a976d5b1c7b061;p=thirdparty%2Fplymouth.git [set-default-theme] Add --help option When running new, unfamiliar commands I usually invoke them with --help to see what options they have. For plymouth-set-default-theme, there is no --help option which I find a bit confusing, especially since the usage is not straight-forward. There is now an additional function "show_help" which displays an help output when invoking plymouth-set-default-theme with --help. --- diff --git a/scripts/plymouth-set-default-theme.in b/scripts/plymouth-set-default-theme.in index fa43901c..195940df 100755 --- a/scripts/plymouth-set-default-theme.in +++ b/scripts/plymouth-set-default-theme.in @@ -13,9 +13,24 @@ if [ -z "$PLYMOUTH_PLUGIN_PATH" ]; then fi fi + function usage () { - echo "usage: plymouth-set-default-theme { --list | --reset | [ --rebuild-initrd ] }" + echo "usage: plymouth-set-default-theme { --list | --reset | [ --rebuild-initrd ] | --help }" +} + +function show_help() { + cat < name of new theme to use (see --list for available themes) + +EOF } function list_themes () @@ -39,6 +54,7 @@ function get_default_theme () DO_RESET=0 DO_INITRD_REBUILD=0 DO_LIST=0 +DO_HELP=0 THEME_NAME="" while [ $# -gt 0 ]; do case "$1" in @@ -79,6 +95,10 @@ while [ $# -gt 0 ]; do DO_RESET=1 ;; + --help) + DO_HELP=1 + ;; + *) if [ -n "$THEME_NAME" ]; then echo "You can only specify one theme at a time" > /dev/stderr @@ -104,6 +124,11 @@ while [ $# -gt 0 ]; do shift done +if [ $DO_HELP -eq 1 ]; then + show_help + exit $? +fi + if [ $DO_LIST -ne 0 ]; then list_themes exit $?