MCPcopy
hub / github.com/urfave/cli / shouldRunCompletion

Function shouldRunCompletion

help.go:498–516  ·  help.go::shouldRunCompletion
(cmd *Command)

Source from the content-addressed store, hash-verified

496}
497
498func shouldRunCompletion(cmd *Command) bool {
499 tracef("checking completions on command %[1]q", cmd.Name)
500
501 if !cmd.Root().shellCompletion {
502 tracef("completion not enabled skipping %[1]q", cmd.Name)
503 return false
504 }
505
506 if argsArguments := cmd.Args(); argsArguments.Present() {
507 name := argsArguments.First()
508 if cmd := cmd.Command(name); cmd != nil {
509 // let the command handle the completion
510 return false
511 }
512 }
513
514 tracef("no subcommand found for completion %[1]q", cmd.Name)
515 return true
516}
517
518func runCompletion(ctx context.Context, cmd *Command) {
519 if cmd.ShellComplete != nil {

Callers 1

runMethod · 0.85

Calls 6

tracefFunction · 0.85
RootMethod · 0.80
ArgsMethod · 0.80
CommandMethod · 0.80
PresentMethod · 0.65
FirstMethod · 0.65

Tested by

no test coverage detected