INNER CODE UNIT · Go
getCommandArgs
c-bata/kube-prompt · kube/completer.go:186
func getCommandArgs(d prompt.Document) []string {
args := strings.Split(d.TextBeforeCursor(), " ")
// If PIPE is in text before the cursor, returns empty.
for i := range args {
if args[i] == "|" {
return nil
}
}
commandArgs, _ := excludeOptions(args)
return commandArgs
}
func excludeOptions(args []string) ([]string, bool) {
l := len(args)
if l == 0 {
return nil, false