summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Glaubitz <glaubitz@physik.fu-berlin.de>2009-12-05 12:05:10 -0500
committerRay Strode <rstrode@redhat.com>2009-12-05 12:08:01 -0500
commit8d6358fc4f69fb00d2909a80f7a976d5b1c7b061 (patch)
tree7ad829250a4e38046164fd92fd7c7f17fb17397d
parent7899b6092a482a42fe828cbaf752c4b06cf1b02c (diff)
[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.
-rwxr-xr-xscripts/plymouth-set-default-theme.in27
1 files changed, 26 insertions, 1 deletions
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 | <theme-name> [ --rebuild-initrd ] }"
+ echo "usage: plymouth-set-default-theme { --list | --reset | <theme-name> [ --rebuild-initrd ] | --help }"
+}
+
+function show_help() {
+ cat <<EOF
+
+ ${0##*/} [opt]
+
+ --help show this help message
+ --list show available themes
+ --reset reset to default theme
+ --rebuild-initrd rebuild initrd (necessary after changing theme)
+ <theme-name> 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 $?