completion

package
v0.1.23 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultStyleConfig

func DefaultStyleConfig()

DefaultStyleConfig sets some default styles for completion.

func ResetFlagsDefaults

func ResetFlagsDefaults(target *cobra.Command)

ResetFlagsDefaults resets all flags to their default values.

Slice flags accumulate per execution (and do not reset),

so we must reset them manually.

Example:

Given cmd.Flags().StringSlice("comment", nil, "")
If you run a command with --comment "a" --comment "b" you will get
the expected [a, b] slice.

If you run a command again with no --comment flags, you will get
[a, b] again instead of an empty slice.

If you run the command again with --comment "c" --comment "d" flags,
you will get [a, b, c, d] instead of just [c, d].

func SplitArgs

func SplitArgs(line []rune, pos int) (args []string, prefixComp, prefixLine string)

SplitArgs splits the line in valid words, prepares them in various ways before calling the completer with them, and also determines which parts of them should be used as prefixes, in the completions and/or in the line.

func UnescapeValue

func UnescapeValue(prefixComp, prefixLine, val string) string

when the completer has returned us some completions, we sometimes needed to post-process them a little before passing them to our shell.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL