MCPcopy Index your code
hub / github.com/docker/cli / setHelpFunc

Function setHelpFunc

cmd/docker/docker.go:246–279  ·  view source on GitHub ↗
(dockerCli command.Cli, cmd *cobra.Command)

Source from the content-addressed store, hash-verified

244}
245
246func setHelpFunc(dockerCli command.Cli, cmd *cobra.Command) {
247 defaultHelpFunc := cmd.HelpFunc()
248 cmd.SetHelpFunc(func(ccmd *cobra.Command, args []string) {
249 if err := pluginmanager.AddPluginCommandStubs(dockerCli, ccmd.Root()); err != nil {
250 ccmd.Println(err)
251 return
252 }
253
254 if len(args) >= 1 {
255 err := tryRunPluginHelp(dockerCli, ccmd, args)
256 if err == nil {
257 return
258 }
259 if !errdefs.IsNotFound(err) {
260 ccmd.Println(err)
261 return
262 }
263 }
264
265 // FIXME(thaJeztah): need a better way for this; hiding the command here, so that it's present" by default for generating docs etc.
266 if c, _, err := ccmd.Find([]string{"buildx"}); c == nil || err != nil {
267 if b, _, _ := ccmd.Find([]string{"bake"}); b != nil {
268 b.Hidden = true
269 }
270 }
271 if err := isSupported(ccmd, dockerCli); err != nil {
272 ccmd.Println(err)
273 return
274 }
275 hideUnsupportedFeatures(ccmd, dockerCli)
276
277 defaultHelpFunc(ccmd, args)
278 })
279}
280
281// visitAll traverses all commands from the root.
282func visitAll(root *cobra.Command, fns ...func(*cobra.Command)) {

Callers 1

newDockerCommandFunction · 0.85

Calls 4

tryRunPluginHelpFunction · 0.85
isSupportedFunction · 0.85
hideUnsupportedFeaturesFunction · 0.85
PrintlnMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…