From 32e5d053282017cbbfc8620078f046eada27bf9a Mon Sep 17 00:00:00 2001 From: Colin Shum Date: Thu, 27 Aug 2020 14:58:40 -0400 Subject: [PATCH] [Fix] Warn user when --template is passed with incompatible flags --- pkg/cmd/repo/create/create.go | 5 +++++ pkg/cmd/repo/create/http.go | 1 + 2 files changed, 6 insertions(+) diff --git a/pkg/cmd/repo/create/create.go b/pkg/cmd/repo/create/create.go index 28d8384cc..57264c879 100644 --- a/pkg/cmd/repo/create/create.go +++ b/pkg/cmd/repo/create/create.go @@ -1,6 +1,7 @@ package create import ( + "errors" "fmt" "net/http" "path" @@ -76,6 +77,10 @@ func NewCmdCreate(f *cmdutil.Factory, runF func(*CreateOptions) error) *cobra.Co return runF(opts) } + if opts.Template != "" && (opts.Homepage != "" || opts.Team != "" || !opts.EnableIssues || !opts.EnableWiki) { + return &cmdutil.FlagError{Err: errors.New(`the '--template' option is not supported with '--homepage, --team, --enable-issues or --enable-wiki'`)} + } + return createRun(opts) }, } diff --git a/pkg/cmd/repo/create/http.go b/pkg/cmd/repo/create/http.go index f3623c6e2..e8d3f29b1 100644 --- a/pkg/cmd/repo/create/http.go +++ b/pkg/cmd/repo/create/http.go @@ -29,6 +29,7 @@ type repoTemplateInput struct { OwnerID string `json:"ownerId,omitempty"` RepositoryID string `json:"repositoryId,omitempty"` + Description string `json:"description,omitempty"` } // repoCreate creates a new GitHub repository