Repository navigation
cli: add flag metadata to --help-autocomplete output - #544
JakeSCahill wants to merge 1 commit into
Conversation
Each entry now carries a flags array with the command's own visible flags, in the shape rpk prints for its own flags in --print-tree. Older rpk versions ignore the field.
|
Commits Review LGTM |
|
Commits Review LGTM |
Each
--help-autocompleteentry now carries aflagsarray: the command's own flags, in the shaperpk --print-treeuses for rpk's flags. With https://github.com/redpanda-data/streaming-enterprise/pull/1134, rpk includes them in--print-tree, so the docs no longer parserpk connect ... --helptext. Tracking: https://redpandadata.atlassian.net/browse/DOC-2689.How urfave/cli v2 flags map:
StringFlagtostring,StringSliceFlagtostringSlice, and so on). Unknown types becomestring.DocGenerationFlag.GetUsage()andRequiredFlag.IsRequired().GetDefaultText()wraps strings in quotes.helpandhelp-autocomplete.path,short,longandargsdon't change.argsstill lists hidden flags, which is out of scope here. There's noexample, because no command setsUsageText.Tested:
help_autocomplete_test.gocovers bool, string, slice (empty and set), duration, int and required flags, an alias becomingshorthand, hidden flags and commands skipped, and[]for a command with no flags. Withflagsemptied, the test fails.go test ./internal/cli/passes.lintandblobl servermatch their--help.blobl server's--hostand--port(shorthandp) intorpk --print-tree.Connect picks this up after a benthos release and a dependency bump in redpanda-data/connect.