Skip to content

Commit

Permalink
Grouping domain, client id and client secret flags together
Browse files Browse the repository at this point in the history
  • Loading branch information
willvedd authored and sergiught committed Dec 9, 2022
1 parent f422fcd commit 389eb7f
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions internal/cli/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,27 @@ import (

var (
loginTenantDomain = Flag{
Name: "Tenant Domain",
LongForm: "domain",
Help: "Specifies tenant domain when authenticating via client credentials (client ID, client secret)",
IsRequired: false,
Name: "Tenant Domain",
LongForm: "domain",
Help: "Specifies tenant domain when authenticating via client credentials (client ID, client secret)",
IsRequired: false,
AlwaysPrompt: true,
}

loginClientID = Flag{
Name: "Client ID",
LongForm: "client-id",
Help: "Client ID of the application.",
IsRequired: true,
Name: "Client ID",
LongForm: "client-id",
Help: "Client ID of the application.",
IsRequired: true,
AlwaysPrompt: true,
}

loginClientSecret = Flag{
Name: "Client Secret",
LongForm: "client-secret",
Help: "Client Secret of the application.",
IsRequired: true,
Name: "Client Secret",
LongForm: "client-secret",
Help: "Client Secret of the application.",
IsRequired: true,
AlwaysPrompt: true,
}
)

Expand Down Expand Up @@ -78,10 +81,12 @@ func loginCmd(cli *cli) *cobra.Command {
loginTenantDomain.RegisterString(cmd, &inputs.Domain, "")
loginClientID.RegisterString(cmd, &inputs.ClientID, "")
loginClientSecret.RegisterString(cmd, &inputs.ClientSecret, "")
cmd.MarkFlagsRequiredTogether("client-id", "client-secret", "domain")

cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
_ = cmd.Flags().MarkHidden("tenant")
_ = cmd.Flags().MarkHidden("json")
_ = cmd.Flags().MarkHidden("no-input")
cmd.Parent().HelpFunc()(cmd, args)
})

Expand Down

0 comments on commit 389eb7f

Please sign in to comment.