MCPcopy
hub / github.com/mislav/hub / findCommandIndex

Function findCommandIndex

commands/args.go:233–251  ·  view source on GitHub ↗
(args []string)

Source from the content-addressed store, hash-verified

231}
232
233func findCommandIndex(args []string) int {
234 slurpNextValue := false
235 commandIndex := 0
236
237 for i, arg := range args {
238 if slurpNextValue {
239 commandIndex = i + 1
240 slurpNextValue = false
241 } else if arg == versionFlag || arg == helpFlag || strings.HasPrefix(arg, listCmds) || !looksLikeFlag(arg) {
242 break
243 } else {
244 commandIndex = i + 1
245 if arg == configFlag || arg == chdirFlag {
246 slurpNextValue = true
247 }
248 }
249 }
250 return commandIndex
251}

Callers 1

NewArgsFunction · 0.85

Calls 1

looksLikeFlagFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…