[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.
calculate-0.9.5
Adrian Glaubitz 15 years ago committed by Ray Strode
parent 7899b6092a
commit 8d6358fc4f

@ -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 $?

Loading…
Cancel
Save