Skip to content
Myr

feat: make InitDefaultCompletionCmd public (#1467)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* feat: make InitDefaultCompletionCmd public * PR comments * Update man_docs_test.go * Update README.md

authored by Gustavo Bazan · committed by GitHub · parent 2169adb · Browse files · 3 files+8 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+8 added−3 removed

  • other:+8 added−3 removed

3 files+8 added−3 removed

modified:doc/README.md+5 added
modified:command.go+1 added-1 removed
994 unmodified lines
995996 // initialize help at the last point to allow for user overriding997 c.InitDefaultHelpCmd()998 // initialize completion at the last point to allow for user overriding999 c.initDefaultCompletionCmd()999 c.InitDefaultCompletionCmd()10001001 args := c.args10021003 // Workaround FAIL with "go test -v" or "cobra.test -test.v", see #155
794 unmodified lines
modified:completions.go+2 added-2 removed
643 unmodified lines
644645 return flag, trimmedArgs, lastArg, nil646}647648// initDefaultCompletionCmd adds a default 'completion' command to c.648// InitDefaultCompletionCmd adds a default 'completion' command to c.649// This function will do nothing if any of the following is true:650// 1- the feature has been explicitly disabled by the program,651// 2- c has no subcommands (to avoid creating one),652// 3- c already has a 'completion' command provided by the program.653func (c *Command) initDefaultCompletionCmd() {653func (c *Command) InitDefaultCompletionCmd() {654 if c.CompletionOptions.DisableDefaultCmd || !c.HasSubCommands() {655 return656 }657
214 unmodified lines