[Fix] Warn user when --template is passed with incompatible flags

This commit is contained in:
Colin Shum 2020-08-27 14:58:40 -04:00
parent 58f62a4a15
commit 32e5d05328
2 changed files with 6 additions and 0 deletions

View file

@ -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)
},
}

View file

@ -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