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

Function setFlagErrorFunc

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

Source from the content-addressed store, hash-verified

193}
194
195func setFlagErrorFunc(dockerCli command.Cli, cmd *cobra.Command) {
196 // When invoking `docker stack --nonsense`, we need to make sure FlagErrorFunc return appropriate
197 // output if the feature is not supported.
198 // As above cli.SetupRootCommand(cmd) have already setup the FlagErrorFunc, we will add a pre-check before the FlagErrorFunc
199 // is called.
200 flagErrorFunc := cmd.FlagErrorFunc()
201 cmd.SetFlagErrorFunc(func(cmd *cobra.Command, err error) error {
202 if err := isSupported(cmd, dockerCli); err != nil {
203 return err
204 }
205 return flagErrorFunc(cmd, err)
206 })
207}
208
209func setupHelpCommand(dockerCli command.Cli, rootCmd, helpCmd *cobra.Command) {
210 origRun := helpCmd.Run

Callers 1

newDockerCommandFunction · 0.85

Calls 1

isSupportedFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…