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

Function buildShellCompletionSubcommand

completion.go:81–98  ·  completion.go::buildShellCompletionSubcommand
(shell string, render renderCompletion, appName string)

Source from the content-addressed store, hash-verified

79}
80
81func buildShellCompletionSubcommand(shell string, render renderCompletion, appName string) *Command {
82 return &Command{
83 Name: shell,
84 Usage: fmt.Sprintf("Output %s completion script", shell),
85 isCompletionCommand: true,
86 Action: func(ctx context.Context, cmd *Command) error {
87 completionScript, err := render(cmd, appName)
88 if err != nil {
89 return Exit(err, 1)
90 }
91 _, err = cmd.Root().Writer.Write([]byte(completionScript))
92 if err != nil {
93 return Exit(err, 1)
94 }
95 return nil
96 },
97 }
98}

Callers 1

buildCompletionCommandFunction · 0.85

Calls 3

ExitFunction · 0.85
WriteMethod · 0.80
RootMethod · 0.80

Tested by

no test coverage detected