"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "pkg/cmd/root/help.go" between
gh-cli-1.11.0.tar.gz and gh-cli-1.12.0.tar.gz

About: GitHub CLI is GitHub’s official command line tool.

help.go  (gh-cli-1.11.0):help.go  (gh-cli-1.12.0)
package root package root
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"strings" "strings"
"github.com/cli/cli/pkg/cmdutil" "github.com/cli/cli/pkg/cmdutil"
"github.com/cli/cli/pkg/iostreams"
"github.com/cli/cli/pkg/text" "github.com/cli/cli/pkg/text"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/spf13/pflag" "github.com/spf13/pflag"
) )
func rootUsageFunc(command *cobra.Command) error { func rootUsageFunc(command *cobra.Command) error {
command.Printf("Usage: %s", command.UseLine()) command.Printf("Usage: %s", command.UseLine())
subcommands := command.Commands() subcommands := command.Commands()
if len(subcommands) > 0 { if len(subcommands) > 0 {
skipping to change at line 83 skipping to change at line 82
} }
command.Print("\n") command.Print("\n")
_ = rootUsageFunc(command) _ = rootUsageFunc(command)
} }
func isRootCmd(command *cobra.Command) bool { func isRootCmd(command *cobra.Command) bool {
return command != nil && !command.HasParent() return command != nil && !command.HasParent()
} }
func rootHelpFunc(cs *iostreams.ColorScheme, command *cobra.Command, args []stri func rootHelpFunc(f *cmdutil.Factory, command *cobra.Command, args []string) {
ng) { cs := f.IOStreams.ColorScheme()
if isRootCmd(command.Parent()) && len(args) >= 2 && args[1] != "--help" & & args[1] != "-h" { if isRootCmd(command.Parent()) && len(args) >= 2 && args[1] != "--help" & & args[1] != "-h" {
nestedSuggestFunc(command, args[1]) nestedSuggestFunc(command, args[1])
hasFailed = true hasFailed = true
return return
} }
coreCommands := []string{} coreCommands := []string{}
actionsCommands := []string{} actionsCommands := []string{}
additionalCommands := []string{} additionalCommands := []string{}
for _, c := range command.Commands() { for _, c := range command.Commands() {
skipping to change at line 146 skipping to change at line 147
if len(coreCommands) > 0 { if len(coreCommands) > 0 {
helpEntries = append(helpEntries, helpEntry{"CORE COMMANDS", stri ngs.Join(coreCommands, "\n")}) helpEntries = append(helpEntries, helpEntry{"CORE COMMANDS", stri ngs.Join(coreCommands, "\n")})
} }
if len(actionsCommands) > 0 { if len(actionsCommands) > 0 {
helpEntries = append(helpEntries, helpEntry{"ACTIONS COMMANDS", s trings.Join(actionsCommands, "\n")}) helpEntries = append(helpEntries, helpEntry{"ACTIONS COMMANDS", s trings.Join(actionsCommands, "\n")})
} }
if len(additionalCommands) > 0 { if len(additionalCommands) > 0 {
helpEntries = append(helpEntries, helpEntry{"ADDITIONAL COMMANDS" , strings.Join(additionalCommands, "\n")}) helpEntries = append(helpEntries, helpEntry{"ADDITIONAL COMMANDS" , strings.Join(additionalCommands, "\n")})
} }
if isRootCmd(command) {
if exts := f.ExtensionManager.List(); len(exts) > 0 {
var names []string
for _, ext := range exts {
names = append(names, ext.Name())
}
helpEntries = append(helpEntries, helpEntry{"EXTENSION CO
MMANDS", strings.Join(names, "\n")})
}
}
flagUsages := command.LocalFlags().FlagUsages() flagUsages := command.LocalFlags().FlagUsages()
if flagUsages != "" { if flagUsages != "" {
helpEntries = append(helpEntries, helpEntry{"FLAGS", dedent(flagU sages)}) helpEntries = append(helpEntries, helpEntry{"FLAGS", dedent(flagU sages)})
} }
inheritedFlagUsages := command.InheritedFlags().FlagUsages() inheritedFlagUsages := command.InheritedFlags().FlagUsages()
if inheritedFlagUsages != "" { if inheritedFlagUsages != "" {
helpEntries = append(helpEntries, helpEntry{"INHERITED FLAGS", de dent(inheritedFlagUsages)}) helpEntries = append(helpEntries, helpEntry{"INHERITED FLAGS", de dent(inheritedFlagUsages)})
} }
if _, ok := command.Annotations["help:arguments"]; ok { if _, ok := command.Annotations["help:arguments"]; ok {
helpEntries = append(helpEntries, helpEntry{"ARGUMENTS", command. Annotations["help:arguments"]}) helpEntries = append(helpEntries, helpEntry{"ARGUMENTS", command. Annotations["help:arguments"]})
 End of changes. 3 change blocks. 
3 lines changed or deleted 14 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)