Update help output
This commit is contained in:
parent
8979c0ce41
commit
30d1257096
4 changed files with 26 additions and 15 deletions
|
|
@ -32,7 +32,7 @@ func rootDisplayCommandTypoHelp(command *cobra.Command, args []string) {
|
|||
|
||||
oldOut := command.OutOrStdout()
|
||||
command.SetOut(errOut)
|
||||
defer command.SetOut(oldOut)
|
||||
command.SetOut(oldOut)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -65,11 +65,13 @@ func rootHelpFunc(command *cobra.Command, args []string) {
|
|||
Body string
|
||||
}
|
||||
|
||||
helpEntries := []helpEntry{
|
||||
{"", command.Long},
|
||||
{"USAGE", command.Use},
|
||||
helpEntries := []helpEntry{}
|
||||
if command.Long != "" {
|
||||
helpEntries = append(helpEntries, helpEntry{"", command.Long})
|
||||
} else if command.Short != "" {
|
||||
helpEntries = append(helpEntries, helpEntry{"", command.Short})
|
||||
}
|
||||
|
||||
helpEntries = append(helpEntries, helpEntry{"USAGE", command.UseLine()})
|
||||
if len(coreCommands) > 0 {
|
||||
helpEntries = append(helpEntries, helpEntry{"CORE COMMANDS", strings.Join(coreCommands, "\n")})
|
||||
}
|
||||
|
|
@ -98,11 +100,8 @@ Read the manual at <http://cli.github.com/manual>`})
|
|||
// If there is a title, add indentation to each line in the body
|
||||
fmt.Fprintln(out, utils.Bold(e.Title))
|
||||
|
||||
for _, l := range strings.Split(e.Body, "\n") {
|
||||
for _, l := range strings.Split(strings.Trim(e.Body, "\n\r"), "\n") {
|
||||
l = strings.Trim(l, " \n\r")
|
||||
if l == "" {
|
||||
continue
|
||||
}
|
||||
fmt.Fprintln(out, " "+l)
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ func init() {
|
|||
}
|
||||
|
||||
var issueCmd = &cobra.Command{
|
||||
Use: "issue <command> [flags]",
|
||||
Use: "issue <command>",
|
||||
Short: "Create and view issues",
|
||||
Long: `Work with GitHub issues`,
|
||||
Example: `$ gh issue list
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ func init() {
|
|||
}
|
||||
|
||||
var prCmd = &cobra.Command{
|
||||
Use: "pr <command> [flags]",
|
||||
Use: "pr <command>",
|
||||
Short: "Create, view, and checkout pull requests",
|
||||
Long: `Work with GitHub pull requests`,
|
||||
Example: `$ gh pr checkout 353
|
||||
|
|
@ -63,7 +63,10 @@ $ gh pr view --web`,
|
|||
var prListCmd = &cobra.Command{
|
||||
Use: "list",
|
||||
Short: "List and filter pull requests in this repository",
|
||||
RunE: prList,
|
||||
Example: `$ gh pr list --limit all
|
||||
$ gh pr list --state closed
|
||||
$ gh pr list --label “priority 1” “bug”`,
|
||||
RunE: prList,
|
||||
}
|
||||
var prStatusCmd = &cobra.Command{
|
||||
Use: "status",
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ func init() {
|
|||
}
|
||||
|
||||
var repoCmd = &cobra.Command{
|
||||
Use: "repo <command> [flags]",
|
||||
Use: "repo <command>",
|
||||
Short: "Create, clone, fork, and view repositories",
|
||||
Long: `Work with GitHub repositories`,
|
||||
Example: `$ gh repo create
|
||||
|
|
@ -69,9 +69,18 @@ To pass 'git clone' flags, separate them with '--'.`,
|
|||
var repoCreateCmd = &cobra.Command{
|
||||
Use: "create [<name>]",
|
||||
Short: "Create a new repository",
|
||||
Long: `Create a new GitHub repository.
|
||||
Long: `Create a new GitHub repository`,
|
||||
Example: utils.Bold("$ gh repo create") + `
|
||||
Will create a repository on your account using the name of your current directory
|
||||
|
||||
Use the "ORG/NAME" syntax to create a repository within your organization.`,
|
||||
` + utils.Bold("$ gh repo create my-project") + `
|
||||
Will create a repository on your account using the name 'my-project'
|
||||
|
||||
` + utils.Bold("$ gh repo create cli/my-project") + `
|
||||
Will create a repository in the organization 'cli' using the name 'my-project'`,
|
||||
Annotations: map[string]string{"help:arguments": `A repository can be supplied as an argument in any of the following formats:
|
||||
- <OWNER/REPO>
|
||||
- by URL, e.g. "https://github.com/OWNER/REPO"`},
|
||||
RunE: repoCreate,
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue