Skip to content

Commit 85dffe3

Browse files
Limit info display to single hook
1 parent a249345 commit 85dffe3

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

commands/info.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,14 @@ func setupInfoCommand() *cobra.Command {
3636
info.Display("conditions", listConditions)
3737
info.Display("options", listOptions)
3838
info.Extended(extended)
39-
instError := info.Run()
4039

41-
if instError != nil {
40+
if len(args) > 0 {
41+
hook := args[0]
42+
info.Hook(hook)
43+
}
44+
runError := info.Run()
45+
46+
if runError != nil {
4247
os.Exit(1)
4348
}
4449
},

exec/config_info.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ func (c *ConfigInfo) displayConditions(conditions []*configuration.Condition, pr
109109
}
110110
}
111111

112+
// displayCondition
112113
func (c *ConfigInfo) displayCondition(condition *configuration.Condition, prefix string) {
113114
c.appIO.Write(prefix+" - "+condition.Run(), true, io.NORMAL)
114115

@@ -127,10 +128,15 @@ func (c *ConfigInfo) displayCondition(condition *configuration.Condition, prefix
127128
}
128129
}
129130

131+
// shouldHookBeDisplayed blocks the hook display if only a specific hook is requested
130132
func (c *ConfigInfo) shouldHookBeDisplayed(hook string) bool {
133+
if c.hook != "" {
134+
return c.hook == hook
135+
}
131136
return c.config.IsHookEnabled(hook)
132137
}
133138

139+
// shouldDisplay indicates if a configuration part should be displayed depending on the configured settings
134140
func (c *ConfigInfo) shouldDisplay(configPart string) bool {
135141
if len(c.show) == 0 {
136142
return true
@@ -139,6 +145,7 @@ func (c *ConfigInfo) shouldDisplay(configPart string) bool {
139145
return ok
140146
}
141147

148+
// yesOrNo converts a boolean to a "yes" or "no" string
142149
func (c *ConfigInfo) yesOrNo(val bool) string {
143150
if val {
144151
return "✅ "

0 commit comments

Comments
 (0)