From 312753924be1109a22269ebde81fa244ef9b6379 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Sun, 23 Feb 2025 00:55:18 +0900 Subject: 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 --- command/unreachable_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'command/unreachable_test.go') 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 -- cgit v1.3.1