Skip to content

Commit 3cdeb28

Browse files
committed
carry --server-url over to the printed --view command on simulate exit
1 parent ece95b9 commit 3cdeb28

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

cmd/lk/simulate.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,17 @@ func dashboardBaseURL() string {
559559
return dashboardURL
560560
}
561561

562+
// viewCommandHint returns the command to re-open a simulation run, carrying
563+
// over --server-url when the run lives somewhere other than the default cloud
564+
// API (e.g. staging), so the printed command targets the same environment.
565+
func viewCommandHint(runID string) string {
566+
hint := "lk agent simulate --view " + runID
567+
if serverURL != cloudAPIServerURL {
568+
hint += " --server-url " + serverURL
569+
}
570+
return hint
571+
}
572+
562573
func simulationDashboardURL(projectID, runID string) string {
563574
if projectID == "" || runID == "" {
564575
return ""

cmd/lk/simulate_tui.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ func runSimulateTUI(config *simulateConfig) error {
8080
}
8181

8282
if m.config.mode == modeView {
83-
fmt.Fprintf(os.Stderr, "To re-open this simulation, run: lk agent simulate --view %s\n", m.config.viewModeRunID)
83+
fmt.Fprintf(os.Stderr, "To re-open this simulation, run: %s\n", viewCommandHint(m.config.viewModeRunID))
8484
} else if m.runID != "" && !m.runFinished {
8585
cancelSimulationRun(config.client, m.runID)
8686
} else if m.runID != "" {
87-
fmt.Fprintf(os.Stderr, "To re-open this simulation, run: lk agent simulate --view %s\n", m.runID)
87+
fmt.Fprintf(os.Stderr, "To re-open this simulation, run: %s\n", viewCommandHint(m.runID))
8888
}
8989

9090
if runErr != nil {

0 commit comments

Comments
 (0)