cli/command/repo.go
vilmibm f3eb092d7e isolate repo fork command and tweak usage
This commit is another isolation refactor, this time for repo fork.
However, I got fed up with the --remote="true|false|prompt" style of
flags and took this opportunity to switch to a set of bool flags:

--remote and --clone
--no-remote and --no-clone

the string args were really non standard and confusing; with only two
bools it was impossible to tell when to prompt.
2020-07-27 13:04:31 -05:00

53 lines
1.3 KiB
Go

package command
import (
"github.com/MakeNowJust/heredoc"
"github.com/spf13/cobra"
)
func init() {
repoCmd.AddCommand(repoCreditsCmd)
repoCreditsCmd.Flags().BoolP("static", "s", false, "Print a static version of the credits")
}
var repoCmd = &cobra.Command{
Use: "repo <command>",
Short: "Create, clone, fork, and view repositories",
Long: `Work with GitHub repositories`,
Example: heredoc.Doc(`
$ gh repo create
$ gh repo clone cli/cli
$ gh repo view --web
`),
Annotations: map[string]string{
"IsCore": "true",
"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"`},
}
var repoCreditsCmd = &cobra.Command{
Use: "credits [<repository>]",
Short: "View credits for a repository",
Example: heredoc.Doc(`
# view credits for the current repository
$ gh repo credits
# view credits for a specific repository
$ gh repo credits cool/repo
# print a non-animated thank you
$ gh repo credits -s
# pipe to just print the contributors, one per line
$ gh repo credits | cat
`),
Args: cobra.MaximumNArgs(1),
RunE: repoCredits,
Hidden: true,
}
func repoCredits(cmd *cobra.Command, args []string) error {
return credits(cmd, args)
}