diff options
| author | Alex Flint <[email protected]> | 2023-02-08 09:49:03 -0500 |
|---|---|---|
| committer | Alex Flint <[email protected]> | 2023-02-08 09:49:03 -0500 |
| commit | df28e7154bbab76436bc59e5dc67fb6d6824fc62 (patch) | |
| tree | 1077d83c624e955733ce4e695465f084f0be9539 /example_test.go | |
| parent | 5dbdd5d0c585feef8723223464a9362d635324f6 (diff) | |
clean up customizable stdout, stderr, and exit in parser config
Diffstat (limited to 'example_test.go')
| -rw-r--r-- | example_test.go | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/example_test.go b/example_test.go index fd64777..5272393 100644 --- a/example_test.go +++ b/example_test.go @@ -162,8 +162,7 @@ func Example_helpText() { } // This is only necessary when running inside golang's runnable example harness - osExit = func(int) {} - stdout = os.Stdout + mustParseExit = func(int) {} MustParse(&args) @@ -195,8 +194,7 @@ func Example_helpPlaceholder() { } // This is only necessary when running inside golang's runnable example harness - osExit = func(int) {} - stdout = os.Stdout + mustParseExit = func(int) {} MustParse(&args) @@ -236,8 +234,7 @@ func Example_helpTextWithSubcommand() { } // This is only necessary when running inside golang's runnable example harness - osExit = func(int) {} - stdout = os.Stdout + mustParseExit = func(int) {} MustParse(&args) @@ -274,8 +271,7 @@ func Example_helpTextWhenUsingSubcommand() { } // This is only necessary when running inside golang's runnable example harness - osExit = func(int) {} - stdout = os.Stdout + mustParseExit = func(int) {} MustParse(&args) @@ -311,10 +307,9 @@ func Example_writeHelpForSubcommand() { } // This is only necessary when running inside golang's runnable example harness - osExit = func(int) {} - stdout = os.Stdout + exit := func(int) {} - p, err := NewParser(Config{}, &args) + p, err := NewParser(Config{Exit: exit}, &args) if err != nil { fmt.Println(err) os.Exit(1) @@ -360,10 +355,9 @@ func Example_writeHelpForSubcommandNested() { } // This is only necessary when running inside golang's runnable example harness - osExit = func(int) {} - stdout = os.Stdout + exit := func(int) {} - p, err := NewParser(Config{}, &args) + p, err := NewParser(Config{Exit: exit}, &args) if err != nil { fmt.Println(err) os.Exit(1) @@ -397,8 +391,7 @@ func Example_errorText() { } // This is only necessary when running inside golang's runnable example harness - osExit = func(int) {} - stderr = os.Stdout + mustParseExit = func(int) {} MustParse(&args) @@ -421,8 +414,7 @@ func Example_errorTextForSubcommand() { } // This is only necessary when running inside golang's runnable example harness - osExit = func(int) {} - stderr = os.Stdout + mustParseExit = func(int) {} MustParse(&args) @@ -457,8 +449,7 @@ func Example_subcommand() { } // This is only necessary when running inside golang's runnable example harness - osExit = func(int) {} - stderr = os.Stdout + mustParseExit = func(int) {} MustParse(&args) |
