Skip to content

Commit

Permalink
Improve CLI error message (hashicorp#5327)
Browse files Browse the repository at this point in the history
  • Loading branch information
kalafut authored Sep 13, 2018
1 parent ccee628 commit d1465bd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions command/token_capabilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,13 @@ func (c *TokenCapabilitiesCommand) Run(args []string) int {
token := ""
path := ""
args = f.Args()
switch {
case len(args) == 1:
switch len(args) {
case 0:
c.UI.Error(fmt.Sprintf("Not enough arguments (expected 1-2, got 0)"))
return 1
case 1:
path = args[0]
case len(args) == 2:
case 2:
token, path = args[0], args[1]
default:
c.UI.Error(fmt.Sprintf("Too many arguments (expected 1-2, got %d)", len(args)))
Expand Down

0 comments on commit d1465bd

Please sign in to comment.