@@ -33,27 +33,20 @@ import (
33
33
34
34
var ranSetup = false
35
35
36
- // SetupCmd defines the Kong args for the setup command (which currently doesn't exist)
37
- type SetupCmd struct {}
38
-
39
- // Run executes the setup command
40
- func (cc * SetupCmd ) Run (ctx * RunContext ) error {
41
- return setupWizard (ctx , false , false )
42
- }
43
-
44
36
type ConfigCmd struct {
45
37
// AddSSO bool `kong:"help='Add a new AWS SSO instance'"`
38
+ Advanced bool `kong:"help='Enable advanced configuration'"`
46
39
}
47
40
48
41
func (cc * ConfigCmd ) Run (ctx * RunContext ) error {
49
42
if err := backupConfig (ctx .Cli .ConfigFile ); err != nil {
50
43
return err
51
44
}
52
45
53
- return setupWizard (ctx , true , false ) // ctx.Cli.Config.AddSSO)
46
+ return setupWizard (ctx , true , false , ctx . Cli . Config . Advanced ) // ctx.Cli.Config.AddSSO)
54
47
}
55
48
56
- func setupWizard (ctx * RunContext , reconfig , addSSO bool ) error {
49
+ func setupWizard (ctx * RunContext , reconfig , addSSO , advanced bool ) error {
57
50
var s = ctx .Settings
58
51
59
52
// Don't run setup twice
@@ -87,17 +80,24 @@ func setupWizard(ctx *RunContext, reconfig, addSSO bool) error {
87
80
// - StartUrl/startHostname
88
81
// - InstanceName
89
82
} else {
90
- instanceName := promptSsoInstance ("" )
83
+ instanceName := "Default"
84
+ if advanced {
85
+ instanceName = promptSsoInstance ("" )
86
+ }
91
87
startHostname := promptStartUrl ("" )
92
88
ssoRegion := promptAwsSsoRegion ("" )
93
- defaultRegion := promptDefaultRegion (ssoRegion )
89
+
90
+ defaultRegion := ""
91
+ if advanced {
92
+ defaultRegion = promptDefaultRegion (ssoRegion )
93
+ }
94
94
95
95
s = & sso.Settings {
96
96
SSO : map [string ]* sso.SSOConfig {},
97
97
UrlAction : "open" ,
98
98
LogLevel : "error" ,
99
99
DefaultRegion : defaultRegion ,
100
- ConsoleDuration : 60 ,
100
+ ConsoleDuration : 720 ,
101
101
CacheRefresh : 168 ,
102
102
AutoConfigCheck : false ,
103
103
FullTextSearch : true ,
@@ -113,38 +113,41 @@ func setupWizard(ctx *RunContext, reconfig, addSSO bool) error {
113
113
}
114
114
}
115
115
116
- // first, caching
117
- s .CacheRefresh = promptCacheRefresh (s .CacheRefresh )
116
+ if advanced {
117
+ // first, caching
118
+ s .CacheRefresh = promptCacheRefresh (s .CacheRefresh )
118
119
119
- if s .CacheRefresh > 0 {
120
- s .AutoConfigCheck = promptAutoConfigCheck (s .AutoConfigCheck )
121
- }
120
+ if s .CacheRefresh > 0 {
121
+ s .AutoConfigCheck = promptAutoConfigCheck (s .AutoConfigCheck )
122
+ }
122
123
123
- // full text search?
124
- s .FullTextSearch = promptFullTextSearch (s .FullTextSearch )
124
+ // full text search?
125
+ s .FullTextSearch = promptFullTextSearch (s .FullTextSearch )
125
126
126
- // next how we open URLs
127
- s .UrlAction = promptUrlAction (s .UrlAction )
128
- s .ConfigProfilesUrlAction = promptConfigProfilesUrlAction (s .ConfigProfilesUrlAction , s .UrlAction )
127
+ // next how we open URLs
128
+ s .UrlAction = promptUrlAction (s .UrlAction )
129
129
130
- // do we need urlExecCommand?
131
- if s .UrlAction == url .Exec {
132
- s .UrlExecCommand = promptUrlExecCommand (s .UrlExecCommand )
133
- } else if s .UrlAction .IsContainer () {
134
- s .UrlExecCommand = promptUseFirefox (s .UrlExecCommand )
135
- } else {
136
- s .UrlExecCommand = []string {}
137
- }
130
+ s .ConfigProfilesUrlAction = promptConfigProfilesUrlAction (s .ConfigProfilesUrlAction , s .UrlAction )
138
131
139
- // should we prompt user to override default browser?
140
- if s .UrlAction == url .Open || s .ConfigProfilesUrlAction == url .ConfigProfilesOpen {
141
- s .Browser = promptDefaultBrowser (s .Browser )
142
- }
132
+ // do we need urlExecCommand?
133
+ if s .UrlAction == url .Exec {
134
+ s .UrlExecCommand = promptUrlExecCommand (s .UrlExecCommand )
135
+ } else if s .UrlAction .IsContainer () {
136
+ s .UrlExecCommand = promptUseFirefox (s .UrlExecCommand )
137
+ } else {
138
+ s .UrlExecCommand = []string {}
139
+ }
143
140
144
- s .ConsoleDuration = promptConsoleDuration (s .ConsoleDuration )
145
- s .HistoryLimit = promptHistoryLimit (s .HistoryLimit )
146
- s .HistoryMinutes = promptHistoryMinutes (s .HistoryMinutes )
147
- s .LogLevel = promptLogLevel (s .LogLevel )
141
+ // should we prompt user to override default browser?
142
+ if s .UrlAction == url .Open || s .ConfigProfilesUrlAction == url .ConfigProfilesOpen {
143
+ s .Browser = promptDefaultBrowser (s .Browser )
144
+ }
145
+
146
+ s .ConsoleDuration = promptConsoleDuration (s .ConsoleDuration )
147
+ s .HistoryLimit = promptHistoryLimit (s .HistoryLimit )
148
+ s .HistoryMinutes = promptHistoryMinutes (s .HistoryMinutes )
149
+ s .LogLevel = promptLogLevel (s .LogLevel )
150
+ }
148
151
149
152
if err := s .Validate (); err != nil {
150
153
return err
0 commit comments