diff --git a/internal/cli/apis.go b/internal/cli/apis.go index b5200b7eb..07b7bb49e 100644 --- a/internal/cli/apis.go +++ b/internal/cli/apis.go @@ -289,7 +289,7 @@ auth0 apis update -n myapi -e 6100 --offline-access=true`, return err } - if !cmd.Flags().Changed(apiOfflineAccess.LongForm) { + if !apiOfflineAccess.IsSet(cmd) { inputs.AllowOfflineAccess = auth0.BoolValue(current.AllowOfflineAccess) } diff --git a/internal/cli/apps.go b/internal/cli/apps.go index 43763647c..5cdc9a81e 100644 --- a/internal/cli/apps.go +++ b/internal/cli/apps.go @@ -355,7 +355,7 @@ auth0 apps create -n myapp -t [native|spa|regular|m2m] -- description -n myapp --type [native|spa|regular|m2m]`, appIsSPA := apiTypeFor(inputs.Type) == appTypeSPA // Prompt for callback URLs if app is not m2m - if !appIsM2M { + if !appIsM2M && !appCallbacks.IsSet(cmd) { var defaultValue string if !appIsNative { @@ -536,7 +536,7 @@ auth0 apps update -n myapp --type [native|spa|regular|m2m]`, } // Prompt for logout URLs if app is not m2m - if !appIsM2M { + if !appIsM2M && !appLogoutURLs.IsSet(cmd) { var defaultValue string if !appIsNative { @@ -553,7 +553,7 @@ auth0 apps update -n myapp --type [native|spa|regular|m2m]`, } // Prompt for allowed origins URLs if app is SPA - if appIsSPA { + if appIsSPA && !appOrigins.IsSet(cmd) { defaultValue := appDefaultURL if len(current.AllowedOrigins) > 0 { @@ -566,7 +566,7 @@ auth0 apps update -n myapp --type [native|spa|regular|m2m]`, } // Prompt for allowed web origins URLs if app is SPA - if appIsSPA { + if appIsSPA && !appWebOrigins.IsSet(cmd) { defaultValue := appDefaultURL if len(current.WebOrigins) > 0 { diff --git a/internal/cli/flags.go b/internal/cli/flags.go index 00d66f9b3..6bb1b9a59 100644 --- a/internal/cli/flags.go +++ b/internal/cli/flags.go @@ -33,6 +33,10 @@ func (f Flag) GetIsRequired() bool { return f.IsRequired } +func (f *Flag) IsSet(cmd *cobra.Command) bool { + return cmd.Flags().Changed(f.LongForm) +} + func (f *Flag) Ask(cmd *cobra.Command, value interface{}, defaultValue *string) error { return askFlag(cmd, f, value, defaultValue, false) } diff --git a/internal/cli/rules.go b/internal/cli/rules.go index cce1575e7..68000acea 100644 --- a/internal/cli/rules.go +++ b/internal/cli/rules.go @@ -313,7 +313,7 @@ auth0 rules update -n "My Updated Rule" --enabled=false`, return err } - if !cmd.Flags().Changed(ruleEnabled.LongForm) { + if !ruleEnabled.IsSet(cmd) { inputs.Enabled = auth0.BoolValue(rule.Enabled) }