Use $DEFAULT_COMMAND pattern from bash-boilerplate

This is more verbose, but consistent with bash-boilerplate's approach.
This commit is contained in:
William Melody 2015-03-18 17:23:15 -07:00
parent 8889e26255
commit 10704e2bd7
1 changed files with 7 additions and 1 deletions

8
hosts
View File

@ -131,6 +131,12 @@ IFS="$SAFER_IFS"
_VERSION="0.1.0-alpha" _VERSION="0.1.0-alpha"
# DEFAULT_COMMAND
#
# The command to be run by default, when no command name is specified. If the
# environment has an existing $DEFAULT_COMMAND set, then that value is used.
DEFAULT_COMMAND="${DEFAULT_COMMAND:-list}"
############################################################################### ###############################################################################
# Debug # Debug
############################################################################### ###############################################################################
@ -401,7 +407,7 @@ _main() {
# If $cmd is blank, then set to help # If $cmd is blank, then set to help
if [[ -z $cmd ]]; then if [[ -z $cmd ]]; then
cmd="list" cmd="$DEFAULT_COMMAND"
fi fi
# Load all of the commands. # Load all of the commands.