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

Method HooksEnabled

cli/command/cli.go:180–207  ·  view source on GitHub ↗

HooksEnabled returns whether plugin hooks are enabled.

()

Source from the content-addressed store, hash-verified

178
179// HooksEnabled returns whether plugin hooks are enabled.
180func (cli *DockerCli) HooksEnabled() bool {
181 // use DOCKER_CLI_HOOKS env var value if set and not empty
182 if v := os.Getenv("DOCKER_CLI_HOOKS"); v != "" {
183 enabled, err := strconv.ParseBool(v)
184 if err != nil {
185 return false
186 }
187 return enabled
188 }
189 // legacy support DOCKER_CLI_HINTS env var
190 if v := os.Getenv("DOCKER_CLI_HINTS"); v != "" {
191 enabled, err := strconv.ParseBool(v)
192 if err != nil {
193 return false
194 }
195 return enabled
196 }
197 featuresMap := cli.ConfigFile().Features
198 if v, ok := featuresMap["hooks"]; ok {
199 enabled, err := strconv.ParseBool(v)
200 if err != nil {
201 return false
202 }
203 return enabled
204 }
205 // default to false
206 return false
207}
208
209// Initialize the dockerCli runs initialization that must happen after command
210// line flags are parsed.

Callers 2

TestHooksEnabledFunction · 0.95
runDockerFunction · 0.80

Calls 1

ConfigFileMethod · 0.95

Tested by 1

TestHooksEnabledFunction · 0.76