package command
Import Path
github.com/reeflective/console/internal/command (on go.dev)
Dependency Relation
imports 4 packages, and imported by one package
Involved Source Files
Package command provides pure utilities for manipulating cobra command
trees: matching commands against console filters, hiding filtered or internal
commands, resetting reused flag state, and locating the command targeted by a
line of input. None of these functions depend on console state, so they can be
tested in isolation; the root console package wraps them in its own methods.
Package-Level Functions (total 5)
ActiveFilters returns the console filters that cmd (or its nearest annotated
ancestor) declares itself incompatible with. A non-empty result means the
command is currently hidden/unavailable under the given console filters.
HideCarapace recursively hides carapace's internal _carapace completion
command so it is never offered as a normal user command.
HideFiltered hides every subcommand of root that matches an active console
filter, so it is not shown in help strings or offered as a completion.
Commands already hidden are left untouched.
ResetCompletionFlagState clears flag state left over from a previous
completion or execution on a reused command tree, before carapace parses the
current input. It restores the target command's flag defaults (shared with
the execution path) and resets ArgsLenAtDash along the command's lineage.
ResetFlagsDefaults resets every flag on target back to its registered default
value and clears its Changed state. Console reuses cobra command trees across
completions and executions; when the application supplies a command tree
directly (no generator), flag state parsed by an earlier run would otherwise
leak into later ones.
Package-Level Constants (only one)
FilterKey is the cobra annotation key whose comma-separated value marks a
command with the filters that hide it. The console re-exports this as
CommandFilterKey for application use.
![]() |
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |