command: use NUL for magic usage string
Test / Create distribution (push) Successful in 52s
Test / Sandbox (push) Successful in 2m51s
Test / Hakurei (push) Successful in 4m44s
Test / Sandbox (race detector) (push) Successful in 5m46s
Test / Hakurei (race detector) (push) Successful in 7m5s
Test / ShareFS (push) Successful in 7m5s
Test / Flake checks (push) Successful in 1m8s

This change also improves documentation.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
cat
2026-08-07 18:57:01 +09:00
parent 6a7f124deb
commit b37c1d8993
6 changed files with 48 additions and 24 deletions
+5
View File
@@ -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