cmd: don't set remotesourcecreate api-url flag as required
check it later since for github it could not be provided and will default to "https://api.github.com"
This commit is contained in:
parent
f861e2a647
commit
9d71f32368
|
@ -55,7 +55,7 @@ func init() {
|
||||||
flags.StringVarP(&remoteSourceCreateOpts.name, "name", "n", "", "remotesource name")
|
flags.StringVarP(&remoteSourceCreateOpts.name, "name", "n", "", "remotesource name")
|
||||||
flags.StringVar(&remoteSourceCreateOpts.rsType, "type", "", "remotesource type")
|
flags.StringVar(&remoteSourceCreateOpts.rsType, "type", "", "remotesource type")
|
||||||
flags.StringVar(&remoteSourceCreateOpts.authType, "auth-type", "", "remote source auth type")
|
flags.StringVar(&remoteSourceCreateOpts.authType, "auth-type", "", "remote source auth type")
|
||||||
flags.StringVar(&remoteSourceCreateOpts.apiURL, "api-url", "", "remotesource api url")
|
flags.StringVar(&remoteSourceCreateOpts.apiURL, "api-url", "", `remotesource api url (when type is "github" defaults to "https://api.github.com")`)
|
||||||
flags.BoolVarP(&remoteSourceCreateOpts.skipVerify, "skip-verify", "", false, "skip remote source api tls certificate verification")
|
flags.BoolVarP(&remoteSourceCreateOpts.skipVerify, "skip-verify", "", false, "skip remote source api tls certificate verification")
|
||||||
flags.StringVar(&remoteSourceCreateOpts.oauth2ClientID, "clientid", "", "remotesource oauth2 client id")
|
flags.StringVar(&remoteSourceCreateOpts.oauth2ClientID, "clientid", "", "remotesource oauth2 client id")
|
||||||
flags.StringVar(&remoteSourceCreateOpts.oauth2ClientSecret, "secret", "", "remotesource oauth2 secret")
|
flags.StringVar(&remoteSourceCreateOpts.oauth2ClientSecret, "secret", "", "remotesource oauth2 secret")
|
||||||
|
@ -71,9 +71,6 @@ func init() {
|
||||||
if err := cmdRemoteSourceCreate.MarkFlagRequired("auth-type"); err != nil {
|
if err := cmdRemoteSourceCreate.MarkFlagRequired("auth-type"); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
if err := cmdRemoteSourceCreate.MarkFlagRequired("api-url"); err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
cmdRemoteSource.AddCommand(cmdRemoteSourceCreate)
|
cmdRemoteSource.AddCommand(cmdRemoteSourceCreate)
|
||||||
}
|
}
|
||||||
|
@ -87,6 +84,10 @@ func remoteSourceCreate(cmd *cobra.Command, args []string) error {
|
||||||
remoteSourceCreateOpts.sshHostKey = github.GitHubSSHHostKey
|
remoteSourceCreateOpts.sshHostKey = github.GitHubSSHHostKey
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if remoteSourceCreateOpts.apiURL == "" {
|
||||||
|
return errors.Errorf(`required flag "api-url" not set`)
|
||||||
|
}
|
||||||
|
|
||||||
req := &api.CreateRemoteSourceRequest{
|
req := &api.CreateRemoteSourceRequest{
|
||||||
Name: remoteSourceCreateOpts.name,
|
Name: remoteSourceCreateOpts.name,
|
||||||
Type: remoteSourceCreateOpts.rsType,
|
Type: remoteSourceCreateOpts.rsType,
|
||||||
|
|
Loading…
Reference in New Issue