Without options, the command prints out a list of all config variables,
together with their current value and the default value.
"
-_com_prefs()
+
+com_prefs()
{
local i conf="${gsu_config_file:=${HOME:-}/.$gsu_name.rc}"
Usage: man"
-_com_man()
+
+com_man()
{
local equal_signs="=================================================="
local minus_signs="--------------------------------------------------"
the subcommand.
"
-_com_help()
+com_help()
{
local a b ere tab=' '
ret=$GSU_SUCCESS
}
-_com_complete()
+com_complete()
{
local cmd n cword
local -a words
fi
arg="$1"
shift
- # check internal commands
- if [[ "$arg" = "help" || "$arg" = "man" || "$arg" = "prefs" || "$arg" = "complete" ]]; then
- _com_$arg "$@"
+ if [[ "$(type -t com_$arg)" == 'function' ]]; then
+ com_$arg "$@"
if (("$ret" < 0)); then
gsu_err_msg
exit 1
fi
exit 0
fi
-
- # external commands
- for i in $gsu_cmds; do
- if test "$arg" = "$i"; then
- ret=$GSU_SUCCESS
- com_$arg "$@"
- if (("$ret" < 0)); then
- gsu_err_msg
- exit 1
- fi
- exit 0
- fi
- done
-
ret=-$E_GSU_BAD_COMMAND
result="$arg"
gsu_err_msg