You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
returnxerrors.Errorf("app %q not found for workspace %q", appSlug, workspaceName)
399
+
}
400
+
401
+
// External apps need to be opened directly, while internal apps require a URL for the Coder dashboard
402
+
varappURLstring
403
+
ifmatchedApp.External {
404
+
appURL=matchedApp.URL
405
+
} else {
406
+
// Construct the URL similar to the frontend's createAppLinkHref
407
+
username:=workspace.OwnerName
408
+
appURL=fmt.Sprintf("%s/@%s/%s.%s/apps/%s/",
409
+
client.URL.String(),
410
+
username,
411
+
workspace.Name,
412
+
workspaceAgent.Name,
413
+
url.PathEscape(appSlug),
414
+
)
415
+
}
416
+
417
+
ifinsideAWorkspace {
418
+
_, _=fmt.Fprintf(inv.Stderr, "Opening %s in %s is not supported inside a workspace, please open the following URL on your local machine instead:\n\n", workspaceName, matchedApp.DisplayName)
419
+
_, _=fmt.Fprintf(inv.Stdout, "%s\n", appURL)
420
+
returnnil
421
+
}
422
+
_, _=fmt.Fprintf(inv.Stderr, "Opening %s in %s\n", workspaceName, matchedApp.DisplayName)
423
+
424
+
if!testOpenError {
425
+
err=open.Run(appURL)
426
+
} else {
427
+
err=xerrors.New("test.open-error")
428
+
}
429
+
iferr!=nil {
430
+
_, _=fmt.Fprintf(inv.Stderr, "Could not automatically open %s in %s: %s\n", workspaceName, matchedApp.DisplayName, err)
431
+
_, _=fmt.Fprintf(inv.Stderr, "Please open the following URL instead:\n\n")
0 commit comments