aboutsummaryrefslogtreecommitdiff
path: root/flag.go
diff options
context:
space:
mode:
Diffstat (limited to 'flag.go')
-rw-r--r--flag.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/flag.go b/flag.go
index 187e4c9..73c237b 100644
--- a/flag.go
+++ b/flag.go
@@ -873,8 +873,10 @@ func VarP(value Value, name, shorthand, usage string) {
// returns the error.
func (f *FlagSet) failf(format string, a ...interface{}) error {
err := fmt.Errorf(format, a...)
- fmt.Fprintln(f.out(), err)
- f.usage()
+ if f.errorHandling != ContinueOnError {
+ fmt.Fprintln(f.out(), err)
+ f.usage()
+ }
return err
}
@@ -1056,6 +1058,7 @@ func (f *FlagSet) Parse(arguments []string) error {
case ContinueOnError:
return err
case ExitOnError:
+ fmt.Println(err)
os.Exit(2)
case PanicOnError:
panic(err)