Documentation
¶
Index ¶
- Variables
- func AcceptMultiline(line []rune) (accept bool)
- func HighlightCommand(done, args []string, root *cobra.Command, cmdColor string) ([]string, []string)
- func HighlightCommandFlags(done, args []string, flagColor string) ([]string, []string)
- func IsEmpty(line string, emptyChars ...rune) bool
- func Parse(line string) (args []string, err error)
- func Split(input string, hl bool) (words []string, remainder string, err error)
- func TrimSpaces(remain []string) (trimmed []string)
- func UnescapeValue(prefixComp, prefixLine, val string) string
Constants ¶
This section is empty.
Variables ¶
var ( // Base text effects. Reset = "\x1b[0m" Bold = "\x1b[1m" Dim = "\x1b[2m" Underscore = "\x1b[4m" Blink = "\x1b[5m" Reverse = "\x1b[7m" // Effects reset. BoldReset = "\x1b[22m" // 21 actually causes underline instead DimReset = "\x1b[22m" UnderscoreReset = "\x1b[24m" BlinkReset = "\x1b[25m" ReverseReset = "\x1b[27m" // Colors GreenFG = "\x1b[32m" YellowFG = "\x1b[33m" ResetFG = "\x1b[39m" BrightWhiteFG = "\x1b[38;05;244m" )
var ( SplitChars = " \n\t" SingleChar = '\'' DoubleChar = '"' EscapeChar = '\\' DoubleEscapeChars = "$`\"\n\\" )
Functions ¶
func AcceptMultiline ¶
acceptMultiline determines if the line just accepted is complete (in which case we should execute it), or incomplete (in which case we must read in multiline).
func HighlightCommand ¶
func HighlightCommand(done, args []string, root *cobra.Command, cmdColor string) ([]string, []string)
HighlightCommand applies highlighting to commands in an input line.
func HighlightCommandFlags ¶
HighlightCommand applies highlighting to command flags in an input line.
func IsEmpty ¶
IsEmpty checks if a given input line is empty. It accepts a list of characters that we consider to be irrelevant, that is, if the given line only contains these characters, it will be considered empty.
func Parse ¶
Parse is in charge of removing all comments from the input line before execution, and if successfully parsed, split into words.
func Split ¶
Split has been copied from go-shellquote and slightly modified so as to also return the remainder when the parsing failed because of an unterminated quote.
func TrimSpaces ¶
TrimSpaces removes all leading/trailing spaces from words
func UnescapeValue ¶
UnescapeValue is used When the completer has returned us some completions, we sometimes need to post-process them a little before passing them to our shell.
Types ¶
This section is empty.