home-manager: check whether a command is passed

"set -u" treats unset variables as an error, and $1 is unbound when no
command is passed.
This commit is contained in:
Mario Rodas 2018-01-22 00:46:33 -05:00 committed by Robert Helgesson
parent 38020d9068
commit 21fefbc8f6
No known key found for this signature in database
GPG key ID: C3DB11069E65DC86

View file

@ -337,6 +337,11 @@ done
# Get rid of the options.
shift "$((OPTIND-1))"
if [[ $# -eq 0 ]]; then
doHelp >&2
exit 1
fi
cmd="$1"
shift 1