Documentation ¶
Overview ¶
Package cobraz contains supplemental logic for dealing with spf13/cobra.
Index ¶
Constants ¶
const ( ShellCompDirectiveErrorText = "ShellCompDirectiveError" ShellCompDirectiveNoSpaceText = "ShellCompDirectiveNoSpace" ShellCompDirectiveNoFileCompText = "ShellCompDirectiveNoFileComp" ShellCompDirectiveFilterFileExtText = "ShellCompDirectiveFilterFileExt" ShellCompDirectiveFilterDirsText = "ShellCompDirectiveFilterDirs" ShellCompDirectiveKeepOrderText = "ShellCompDirectiveKeepOrder" ShellCompDirectiveDefaultText = "ShellCompDirectiveDefault" ShellCompDirectiveUnknownText = "ShellCompDirectiveUnknown" )
Defines the text values for cobra.ShellCompDirective.
const ShellCompGenScriptsCmd = "completion"
ShellCompGenScriptsCmd is the name of the cobra built-in "completion" command that generates shell completion scripts. Note that this is not the same as the hidden "__complete" command that actually returns the completion results. That's cobra.ShellCompRequestCmd (and also cobra.ShellCompNoDescRequestCmd).
Variables ¶
This section is empty.
Functions ¶
func ExtractDirectives ¶
func ExtractDirectives(result cobra.ShellCompDirective) []cobra.ShellCompDirective
ExtractDirectives extracts the individual directives from a combined directive.
func MarshalDirective ¶
func MarshalDirective(directive cobra.ShellCompDirective) []string
MarshalDirective marshals a cobra.ShellCompDirective to text strings, after extracting the embedded directives.
func ParseDirectivesLine ¶
func ParseDirectivesLine(directivesLine string) []cobra.ShellCompDirective
ParseDirectivesLine parses the line of text returned by "__complete" cmd that contains the text description of the result. The line looks like:
Completion ended with directive: ShellCompDirectiveNoSpace, ShellCompDirectiveKeepOrder
Note that this function will panic on an unknown directive.
Types ¶
This section is empty.