Skip to content

Commit 6ed6c06

Browse files
committed
make the conditions more readable
1 parent cc2e0c7 commit 6ed6c06

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

cmd/docker-mcp/hints/hints.go

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,21 @@ import (
77

88
func Enabled(dockerCli command.Cli) bool {
99
configFile := dockerCli.ConfigFile()
10-
if configFile != nil && configFile.Plugins != nil {
11-
if pluginConfig, ok := configFile.Plugins["-x-cli-hints"]; ok {
12-
if enabledValue, exists := pluginConfig["enabled"]; exists {
13-
return enabledValue == "true"
14-
}
15-
}
10+
if configFile == nil || configFile.Plugins == nil {
11+
return true
1612
}
1713

18-
return true
14+
pluginConfig, ok := configFile.Plugins["-x-cli-hints"]
15+
if !ok {
16+
return true
17+
}
18+
19+
enabledValue, exists := pluginConfig["enabled"]
20+
if !exists {
21+
return true
22+
}
23+
24+
return enabledValue == "true"
1925
}
2026

2127
var (

0 commit comments

Comments
 (0)