Skip to content
This repository has been archived by the owner on Aug 27, 2019. It is now read-only.

Commit

Permalink
Merge pull request #62 from jhernand/url_option_is_not_mandatory
Browse files Browse the repository at this point in the history
Option `--url` is not mandatory
  • Loading branch information
jhernand authored Aug 15, 2019
2 parents 03cc396 + 063d0af commit 5dd6c0e
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions cmd/uhc/login/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ var Cmd = &cobra.Command{
}

func init() {
var err error

flags := Cmd.Flags()
flags.StringVar(
&args.tokenURL,
Expand Down Expand Up @@ -110,11 +108,6 @@ func init() {
client.DefaultURL,
"URL of the API gateway.",
)
err = Cmd.MarkFlagRequired("url")
if err != nil {
fmt.Fprintf(os.Stderr, "Can't mark flag as required: %v\n", err)
os.Exit(1)
}
flags.StringVar(
&args.token,
"token",
Expand Down Expand Up @@ -154,6 +147,11 @@ func init() {
func run(cmd *cobra.Command, argv []string) error {
var err error

// Check mandatory options:
if args.url == "" {
return fmt.Errorf("Option '--url' is mandatory")
}

// Check that we have some kind of credentials:
havePassword := args.user != "" && args.password != ""
haveSecret := args.clientID != "" && args.clientSecret != ""
Expand Down

0 comments on commit 5dd6c0e

Please sign in to comment.