From 10704e2bd753458f71cb6f0529220b31eb66439e Mon Sep 17 00:00:00 2001 From: William Melody Date: Wed, 18 Mar 2015 17:23:15 -0700 Subject: [PATCH] Use $DEFAULT_COMMAND pattern from bash-boilerplate This is more verbose, but consistent with bash-boilerplate's approach. --- hosts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hosts b/hosts index d66f796..41c70e0 100755 --- a/hosts +++ b/hosts @@ -131,6 +131,12 @@ IFS="$SAFER_IFS" _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 ############################################################################### @@ -401,7 +407,7 @@ _main() { # If $cmd is blank, then set to help if [[ -z $cmd ]]; then - cmd="list" + cmd="$DEFAULT_COMMAND" fi # Load all of the commands.