MCPcopy Create free account
hub / github.com/UiPath/uipathcli / Find

Method Find

commandline/autocomplete_handler.go:137–158  ·  view source on GitHub ↗
(commandText string, command *CommandDefinition, exclude []string)

Source from the content-addressed store, hash-verified

135}
136
137func (a autoCompleteHandler) Find(commandText string, command *CommandDefinition, exclude []string) []string {
138 words := strings.Split(commandText, " ")
139 if len(words) < 2 {
140 return []string{}
141 }
142
143 for _, word := range words[1 : len(words)-1] {
144 if strings.HasPrefix(word, "-") {
145 break
146 }
147 command = a.findCommand(word, command.Subcommands)
148 if command == nil {
149 return []string{}
150 }
151 }
152
153 lastWord := words[len(words)-1]
154 if strings.HasPrefix(lastWord, "-") {
155 return a.searchFlags(strings.TrimLeft(lastWord, "-"), command, append(exclude, words...))
156 }
157 return a.searchCommands(lastWord, command.Subcommands, exclude)
158}
159
160func (a autoCompleteHandler) findCommand(name string, commands []*CommandDefinition) *CommandDefinition {
161 for _, command := range commands {

Callers 2

parseMethod · 0.80

Calls 3

findCommandMethod · 0.95
searchFlagsMethod · 0.95
searchCommandsMethod · 0.95

Tested by

no test coverage detected