diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-02-23 00:55:18 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-02-23 00:55:18 +0900 |
| commit | 312753924be1109a22269ebde81fa244ef9b6379 (patch) | |
| tree | 4d2d7e4f1b07f675eeac82dad55478714981a597 /command/unreachable_test.go | |
| parent | 54308f79d206f89807aba3bc998fc770d01efed1 (diff) | |
command: root early handler func special case
This allows for early initialisation with access to flags on the root node. This can be useful for configuring global state used by subcommands.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'command/unreachable_test.go')
| -rw-r--r-- | command/unreachable_test.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/command/unreachable_test.go b/command/unreachable_test.go index 9ace4794..71408189 100644 --- a/command/unreachable_test.go +++ b/command/unreachable_test.go @@ -24,10 +24,10 @@ func TestParseUnreachable(t *testing.T) { // a node with descendents must not have a direct handler t.Run("sub handle conflict", func(t *testing.T) { defer checkRecover(t, "Parse", "invalid subcommand tree state") - n := newNode(panicWriter{}, nil, " ", "") + n := newNode(panicWriter{}, nil, " ", " ") n.adopt(newNode(panicWriter{}, nil, " ", " ")) n.f = func([]string) error { panic("unreachable") } - _ = n.Parse(nil) + _ = n.Parse([]string{" "}) }) // this would only happen if a node was matched twice |
