Skip to content

Commit 730b5dd

Browse files
committed
enrich the "not logged in" error message with the full path to the coder
executable Signed-off-by: Callum Styan <callumstyan@gmail.com>
1 parent ae3d90b commit 730b5dd

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cli/root.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const (
7272
varDisableDirect = "disable-direct-connections"
7373
varDisableNetworkTelemetry = "disable-network-telemetry"
7474

75-
notLoggedInMessage = "You are not logged in. Try logging in using 'coder login <url>'."
75+
notLoggedInMessage = "You are not logged in. Try logging in using '%s login <url>'."
7676

7777
envNoVersionCheck = "CODER_NO_VERSION_WARNING"
7878
envNoFeatureWarning = "CODER_NO_FEATURE_WARNING"
@@ -534,7 +534,11 @@ func (r *RootCmd) InitClient(client *codersdk.Client) serpent.MiddlewareFunc {
534534
rawURL, err := conf.URL().Read()
535535
// If the configuration files are absent, the user is logged out
536536
if os.IsNotExist(err) {
537-
return xerrors.New(notLoggedInMessage)
537+
binPath, err := os.Executable()
538+
if err != nil {
539+
binPath = "coder"
540+
}
541+
return xerrors.Errorf(notLoggedInMessage, binPath)
538542
}
539543
if err != nil {
540544
return err

0 commit comments

Comments
 (0)