aboutsummaryrefslogtreecommitdiff
path: root/flag.go
diff options
context:
space:
mode:
authorAlbert Nigmatzianov <[email protected]>2017-04-19 14:27:09 +0200
committerAlbert Nigmatzianov <[email protected]>2017-04-26 21:20:41 +0200
commit9c8891d278271e84769ed47a1f769336291c02b8 (patch)
tree6416caf7da0ac39c6d143e1a223f52c51b25cc63 /flag.go
parent1d9fab458082a6f06834b844d331fb039a6821b3 (diff)
Add more verbosity to panic of shorthand redefinition
See https://github.com/spf13/cobra/issues/27#issuecomment-294690084
Diffstat (limited to 'flag.go')
-rw-r--r--flag.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/flag.go b/flag.go
index a5a0f25..7cc8e79 100644
--- a/flag.go
+++ b/flag.go
@@ -793,7 +793,7 @@ func (f *FlagSet) AddFlag(flag *Flag) {
old, alreadyThere := f.shorthands[c]
if alreadyThere {
fmt.Fprintf(f.out(), "%s shorthand reused: %q for %s already used for %s\n", f.name, c, flag.Name, old.Name)
- panic("shorthand redefinition")
+ panic(fmt.Sprintf("unable to redefine %q shorthand", c))
}
f.shorthands[c] = flag
}