@@ -31,13 +31,14 @@ var (
31
31
)
32
32
33
33
const (
34
- varURL = "url"
35
- varToken = "token"
36
- varAgentToken = "agent-token"
37
- varAgentURL = "agent-url"
38
- varGlobalConfig = "global-config"
39
- varNoOpen = "no-open"
40
- varForceTty = "force-tty"
34
+ varURL = "url"
35
+ varToken = "token"
36
+ varAgentToken = "agent-token"
37
+ varAgentURL = "agent-url"
38
+ varGlobalConfig = "global-config"
39
+ varNoOpen = "no-open"
40
+ varForceTty = "force-tty"
41
+ notLoggedInMessage = "You are not logged in. Try logging in using 'coder login <url>'."
41
42
)
42
43
43
44
func init () {
@@ -112,13 +113,12 @@ func Root() *cobra.Command {
112
113
func createClient (cmd * cobra.Command ) (* codersdk.Client , error ) {
113
114
root := createConfig (cmd )
114
115
rawURL , err := cmd .Flags ().GetString (varURL )
115
- loginHelper := "You are not logged in. Try logging in using 'coder login <url>'."
116
116
if err != nil || rawURL == "" {
117
117
rawURL , err = root .URL ().Read ()
118
118
if err != nil {
119
119
// If the configuration files are absent, the user is logged out
120
120
if os .IsNotExist (err ) {
121
- return nil , xerrors .New (loginHelper )
121
+ return nil , xerrors .New (notLoggedInMessage )
122
122
}
123
123
return nil , err
124
124
}
@@ -133,7 +133,7 @@ func createClient(cmd *cobra.Command) (*codersdk.Client, error) {
133
133
if err != nil {
134
134
// If the configuration files are absent, the user is logged out
135
135
if os .IsNotExist (err ) {
136
- return nil , xerrors .New (loginHelper )
136
+ return nil , xerrors .New (notLoggedInMessage )
137
137
}
138
138
return nil , err
139
139
}
0 commit comments