diff options
| author | Alex Flint <[email protected]> | 2024-06-28 11:03:08 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-06-28 11:03:08 -0400 |
| commit | bee5cf5d7cc07c41b2a528052bfba0566b5069c0 (patch) | |
| tree | d0157b78d82c7667de1973da81e8d108b1ed509a /parse.go | |
| parent | dfca71d1594a749ef5e2203e84cfb5a1b8e9387b (diff) | |
| parent | aa844c7de9f0314b1fe66b9bdcc12090c7d0905e (diff) | |
Merge pull request #255 from hhromic/fix-254v1.5.1
Fix crash on errors in package-level `MustParse`
Diffstat (limited to 'parse.go')
| -rw-r--r-- | parse.go | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -76,12 +76,13 @@ var ErrHelp = errors.New("help requested by user") // ErrVersion indicates that the builtin --version was provided var ErrVersion = errors.New("version requested by user") -// for monkey patching in example code +// for monkey patching in example and test code var mustParseExit = os.Exit +var mustParseOut io.Writer = os.Stdout // MustParse processes command line arguments and exits upon failure func MustParse(dest ...interface{}) *Parser { - return mustParse(Config{Exit: mustParseExit}, dest...) + return mustParse(Config{Exit: mustParseExit, Out: mustParseOut}, dest...) } // mustParse is a helper that facilitates testing |
