Merge pull request #3341 from cli/actions-help-section
Add section in help for actions commands
This commit is contained in:
commit
01b3f0f1cb
4 changed files with 17 additions and 6 deletions
|
|
@ -26,6 +26,9 @@ func NewCmdActions(f *cmdutil.Factory) *cobra.Command {
|
|||
Run: func(cmd *cobra.Command, args []string) {
|
||||
actionsRun(opts)
|
||||
},
|
||||
Annotations: map[string]string{
|
||||
"IsActions": "true",
|
||||
},
|
||||
}
|
||||
|
||||
return cmd
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ func rootHelpFunc(cs *iostreams.ColorScheme, command *cobra.Command, args []stri
|
|||
}
|
||||
|
||||
coreCommands := []string{}
|
||||
actionsCommands := []string{}
|
||||
additionalCommands := []string{}
|
||||
for _, c := range command.Commands() {
|
||||
if c.Short == "" {
|
||||
|
|
@ -100,6 +101,8 @@ func rootHelpFunc(cs *iostreams.ColorScheme, command *cobra.Command, args []stri
|
|||
s := rpad(c.Name()+":", c.NamePadding()) + c.Short
|
||||
if _, ok := c.Annotations["IsCore"]; ok {
|
||||
coreCommands = append(coreCommands, s)
|
||||
} else if _, ok := c.Annotations["IsActions"]; ok {
|
||||
actionsCommands = append(actionsCommands, s)
|
||||
} else {
|
||||
additionalCommands = append(additionalCommands, s)
|
||||
}
|
||||
|
|
@ -126,6 +129,9 @@ func rootHelpFunc(cs *iostreams.ColorScheme, command *cobra.Command, args []stri
|
|||
if len(coreCommands) > 0 {
|
||||
helpEntries = append(helpEntries, helpEntry{"CORE COMMANDS", strings.Join(coreCommands, "\n")})
|
||||
}
|
||||
if len(actionsCommands) > 0 {
|
||||
helpEntries = append(helpEntries, helpEntry{"ACTIONS COMMANDS", strings.Join(actionsCommands, "\n")})
|
||||
}
|
||||
if len(additionalCommands) > 0 {
|
||||
helpEntries = append(helpEntries, helpEntry{"ADDITIONAL COMMANDS", strings.Join(additionalCommands, "\n")})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,10 +11,11 @@ func NewCmdRun(f *cmdutil.Factory) *cobra.Command {
|
|||
cmd := &cobra.Command{
|
||||
Use: "run <command>",
|
||||
Short: "View details about workflow runs",
|
||||
Hidden: true,
|
||||
Long: "List, view, and watch recent workflow runs from GitHub Actions.",
|
||||
// TODO i'd like to have all the actions commands sorted into their own zone which i think will
|
||||
// require a new annotation
|
||||
Hidden: true,
|
||||
Annotations: map[string]string{
|
||||
"IsActions": "true",
|
||||
},
|
||||
}
|
||||
cmdutil.EnableRepoOverride(cmd, f)
|
||||
|
||||
|
|
|
|||
|
|
@ -12,10 +12,11 @@ func NewCmdWorkflow(f *cmdutil.Factory) *cobra.Command {
|
|||
cmd := &cobra.Command{
|
||||
Use: "workflow <command>",
|
||||
Short: "View details about GitHub Actions workflows",
|
||||
Hidden: true,
|
||||
Long: "List, view, and run workflows in GitHub Actions.",
|
||||
// TODO i'd like to have all the actions commands sorted into their own zone which i think will
|
||||
// require a new annotation
|
||||
Hidden: true,
|
||||
Annotations: map[string]string{
|
||||
"IsActions": "true",
|
||||
},
|
||||
}
|
||||
cmdutil.EnableRepoOverride(cmd, f)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue