Updated login CLI flags

This commit is contained in:
David J. Allen 2024-03-19 14:58:10 -06:00
parent d0f8c9087d
commit 084a49d09f
No known key found for this signature in database
GPG key ID: 717C593FF60A2ACC

View file

@ -14,6 +14,7 @@ import (
var (
client oauth.Client
scope []string
target string = ""
targetIndex int = -1
)
@ -99,7 +100,8 @@ func init() {
loginCmd.Flags().StringVar(&client.Id, "client.id", client.Id, "set the client ID")
loginCmd.Flags().StringVar(&client.Secret, "client.secret", client.Secret, "set the client secret")
loginCmd.Flags().StringSliceVar(&client.RedirectUris, "client.redirect-uris", client.RedirectUris, "set the redirect URI")
loginCmd.Flags().StringSliceVar(&client.Scope, "client.scope", client.Scope, "set the scopes")
loginCmd.Flags().StringSliceVar(&client.Scope, "client.scope", client.Scope, "set the identity provider scopes")
loginCmd.Flags().StringSliceVar(&config.Authorization.Token.Scope, "token.scope", scope, "set the access token scope")
loginCmd.Flags().StringVar(&config.Server.Host, "server.host", config.Server.Host, "set the listening host")
loginCmd.Flags().IntVar(&config.Server.Port, "server.port", config.Server.Port, "set the listening port")
loginCmd.Flags().BoolVar(&config.Options.OpenBrowser, "open-browser", config.Options.OpenBrowser, "automatically open link in browser")
@ -107,8 +109,8 @@ func init() {
loginCmd.Flags().StringVar(&config.Options.FlowType, "flow", config.Options.FlowType, "set the grant-type/authorization flow")
loginCmd.Flags().BoolVar(&config.Options.CacheOnly, "cache-only", config.Options.CacheOnly, "only fetch identity provider configs stored locally")
loginCmd.Flags().BoolVar(&config.Authentication.TestAllClients, "test-all", config.Authentication.TestAllClients, "test all clients in config for a valid provider")
loginCmd.Flags().StringVar(&target, "target", "", "set target client to use from config by name")
loginCmd.Flags().IntVar(&targetIndex, "index", -1, "set target client to use from config by index")
loginCmd.MarkFlagsMutuallyExclusive("target", "index")
loginCmd.Flags().StringVar(&target, "target.name", "", "set target client to use from config by name")
loginCmd.Flags().IntVar(&targetIndex, "target.index", -1, "set target client to use from config by index")
loginCmd.MarkFlagsMutuallyExclusive("target.name", "target.index")
rootCmd.AddCommand(loginCmd)
}