Skip to content

Commit

Permalink
Show help message on missing arguments (#647)
Browse files Browse the repository at this point in the history
  • Loading branch information
desyncr authored Jan 15, 2018
1 parent a6e4507 commit d1dd78b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
4 changes: 2 additions & 2 deletions bin/antigen.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ compdef () { __deferred_compdefs=($__deferred_compdefs "$*") }
antigen () {
local cmd="$1"
if [[ -z "$cmd" ]]; then
echo 'Antigen: Please give a command to run.' >&2
antigen-help >&2
return 1
fi
shift
Expand Down Expand Up @@ -1402,7 +1402,7 @@ antigen-use () {
antigen-version () {
local extensions

printf "Antigen %s (%s)\nRevision date: %s\n" "develop" "f3b7bc4" "2018-01-14 13:05:10 -0300"
printf "Antigen %s (%s)\nRevision date: %s\n" "develop" "9312823" "2018-01-15 14:20:20 -0300"

# Show extension information if any is available
if (( $+functions[antigen-ext] )); then
Expand Down
2 changes: 1 addition & 1 deletion src/antigen.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ compdef () { __deferred_compdefs=($__deferred_compdefs "$*") }
antigen () {
local cmd="$1"
if [[ -z "$cmd" ]]; then
echo 'Antigen: Please give a command to run.' >&2
antigen-help >&2
return 1
fi
shift
Expand Down
13 changes: 13 additions & 0 deletions tests/antigen-wrapper.t
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,16 @@ Call with an alias
$ alias a=antigen
$ a dummy
me dummy

Call without arguments should exit with error.

$ antigen 2>/dev/null
[1]

Call without arguments should display help message.

$ antigen 2>&1 | head -n 4
Antigen .* (re)
Revision .* (re)

Antigen is a .* (re)

0 comments on commit d1dd78b

Please sign in to comment.