Add "new" alias to "create" commands (#5388)

Co-authored-by: Mislav Marohnić <mislav@github.com>
This commit is contained in:
Christopher Nethercott 2022-04-11 15:48:34 +01:00 committed by GitHub
parent 8a0c1f903c
commit 933a91e18e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 3 deletions

View file

@ -86,6 +86,7 @@ func NewCmdCreate(f *cmdutil.Factory, runF func(*CreateOptions) error) *cobra.Co
}
return nil
},
Aliases: []string{"new"},
RunE: func(c *cobra.Command, args []string) error {
opts.Filenames = args

View file

@ -64,7 +64,8 @@ func NewCmdCreate(f *cmdutil.Factory, runF func(*CreateOptions) error) *cobra.Co
$ gh issue create --assignee "@me"
$ gh issue create --project "Roadmap"
`),
Args: cmdutil.NoArgsQuoteReminder,
Args: cmdutil.NoArgsQuoteReminder,
Aliases: []string{"new"},
RunE: func(cmd *cobra.Command, args []string) error {
// support `-R, --repo` override
opts.BaseRepo = f.BaseRepo

View file

@ -116,7 +116,8 @@ func NewCmdCreate(f *cmdutil.Factory, runF func(*CreateOptions) error) *cobra.Co
$ gh pr create --project "Roadmap"
$ gh pr create --base develop --head monalisa:feature
`),
Args: cmdutil.NoArgsQuoteReminder,
Args: cmdutil.NoArgsQuoteReminder,
Aliases: []string{"new"},
RunE: func(cmd *cobra.Command, args []string) error {
opts.Finder = shared.NewFinder(f)

View file

@ -109,6 +109,7 @@ func NewCmdCreate(f *cmdutil.Factory, runF func(*CreateOptions) error) *cobra.Co
Create a release and start a discussion
$ gh release create v1.2.3 --discussion-category "General"
`),
Aliases: []string{"new"},
RunE: func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("discussion-category") && opts.Draft {
return errors.New("discussions for draft releases not supported")

View file

@ -82,7 +82,8 @@ func NewCmdCreate(f *cmdutil.Factory, runF func(*CreateOptions) error) *cobra.Co
# create a remote repository from the current directory
gh repo create my-project --private --source=. --remote=upstream
`),
Args: cobra.MaximumNArgs(1),
Args: cobra.MaximumNArgs(1),
Aliases: []string{"new"},
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) > 0 {
opts.Name = args[0]