Skip to content

Commit 8b1ed28

Browse files
committed
Add section in help for actions commands
1 parent df58831 commit 8b1ed28

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

pkg/cmd/actions/actions.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ func NewCmdActions(f *cmdutil.Factory) *cobra.Command {
2626
Run: func(cmd *cobra.Command, args []string) {
2727
actionsRun(opts)
2828
},
29+
Annotations: map[string]string{
30+
"IsActions": "true",
31+
},
2932
}
3033

3134
return cmd

pkg/cmd/root/help.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ func rootHelpFunc(cs *iostreams.ColorScheme, command *cobra.Command, args []stri
8888
}
8989

9090
coreCommands := []string{}
91+
actionsCommands := []string{}
9192
additionalCommands := []string{}
9293
for _, c := range command.Commands() {
9394
if c.Short == "" {
@@ -100,6 +101,8 @@ func rootHelpFunc(cs *iostreams.ColorScheme, command *cobra.Command, args []stri
100101
s := rpad(c.Name()+":", c.NamePadding()) + c.Short
101102
if _, ok := c.Annotations["IsCore"]; ok {
102103
coreCommands = append(coreCommands, s)
104+
} else if _, ok := c.Annotations["IsActions"]; ok {
105+
actionsCommands = append(actionsCommands, s)
103106
} else {
104107
additionalCommands = append(additionalCommands, s)
105108
}
@@ -126,6 +129,9 @@ func rootHelpFunc(cs *iostreams.ColorScheme, command *cobra.Command, args []stri
126129
if len(coreCommands) > 0 {
127130
helpEntries = append(helpEntries, helpEntry{"CORE COMMANDS", strings.Join(coreCommands, "\n")})
128131
}
132+
if len(actionsCommands) > 0 {
133+
helpEntries = append(helpEntries, helpEntry{"ACTIONS COMMANDS", strings.Join(actionsCommands, "\n")})
134+
}
129135
if len(additionalCommands) > 0 {
130136
helpEntries = append(helpEntries, helpEntry{"ADDITIONAL COMMANDS", strings.Join(additionalCommands, "\n")})
131137
}

pkg/cmd/run/run.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ func NewCmdRun(f *cmdutil.Factory) *cobra.Command {
1111
cmd := &cobra.Command{
1212
Use: "run <command>",
1313
Short: "View details about workflow runs",
14-
Hidden: true,
1514
Long: "List, view, and watch recent workflow runs from GitHub Actions.",
16-
// TODO i'd like to have all the actions commands sorted into their own zone which i think will
17-
// require a new annotation
15+
Hidden: true,
16+
Annotations: map[string]string{
17+
"IsActions": "true",
18+
},
1819
}
1920
cmdutil.EnableRepoOverride(cmd, f)
2021

pkg/cmd/workflow/workflow.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ func NewCmdWorkflow(f *cmdutil.Factory) *cobra.Command {
1212
cmd := &cobra.Command{
1313
Use: "workflow <command>",
1414
Short: "View details about GitHub Actions workflows",
15-
Hidden: true,
1615
Long: "List, view, and run workflows in GitHub Actions.",
17-
// TODO i'd like to have all the actions commands sorted into their own zone which i think will
18-
// require a new annotation
16+
Hidden: true,
17+
Annotations: map[string]string{
18+
"IsActions": "true",
19+
},
1920
}
2021
cmdutil.EnableRepoOverride(cmd, f)
2122

0 commit comments

Comments
 (0)