From b37c1d899349fef9e7af38940ae0c2d507c433a9 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Fri, 7 Aug 2026 18:57:01 +0900 Subject: command: use NUL for magic usage string This change also improves documentation. Signed-off-by: Ophestra --- command/node.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'command/node.go') diff --git a/command/node.go b/command/node.go index 4d09c975..b6f84bf8 100644 --- a/command/node.go +++ b/command/node.go @@ -6,6 +6,7 @@ import ( "strings" ) +// A node represents a command. type node struct { child, next *node name, usage string @@ -13,13 +14,16 @@ type node struct { out io.Writer logf LogFunc + // Names of commands preceding node. prefix []string + // Short user-facing representations of flags received by node. suffix strings.Builder f HandlerFunc set *flag.FlagSet } +// adopt adds v as the last child of n. func (n *node) adopt(v *node) bool { if n.child != nil { return n.child.append(v) @@ -28,6 +32,7 @@ func (n *node) adopt(v *node) bool { return true } +// append adds v as the last sibling of n. func (n *node) append(v *node) bool { if n.name == v.name { return false -- cgit v1.3.1