diff --git a/cmd/lk/simulate.go b/cmd/lk/simulate.go index 4b3cfc7a..e0aeaf27 100644 --- a/cmd/lk/simulate.go +++ b/cmd/lk/simulate.go @@ -559,6 +559,17 @@ func dashboardBaseURL() string { return dashboardURL } +// viewCommandHint returns the command to re-open a simulation run, carrying +// over --server-url when the run lives somewhere other than the default cloud +// API (e.g. staging), so the printed command targets the same environment. +func viewCommandHint(runID string) string { + hint := "lk agent simulate --view " + runID + if serverURL != cloudAPIServerURL { + hint += " --server-url " + serverURL + } + return hint +} + func simulationDashboardURL(projectID, runID string) string { if projectID == "" || runID == "" { return "" diff --git a/cmd/lk/simulate_tui.go b/cmd/lk/simulate_tui.go index c064d552..b91ec37d 100644 --- a/cmd/lk/simulate_tui.go +++ b/cmd/lk/simulate_tui.go @@ -80,11 +80,11 @@ func runSimulateTUI(config *simulateConfig) error { } if m.config.mode == modeView { - fmt.Fprintf(os.Stderr, "To re-open this simulation, run: lk agent simulate --view %s\n", m.config.viewModeRunID) + fmt.Fprintf(os.Stderr, "To re-open this simulation, run: %s\n", viewCommandHint(m.config.viewModeRunID)) } else if m.runID != "" && !m.runFinished { cancelSimulationRun(config.client, m.runID) } else if m.runID != "" { - fmt.Fprintf(os.Stderr, "To re-open this simulation, run: lk agent simulate --view %s\n", m.runID) + fmt.Fprintf(os.Stderr, "To re-open this simulation, run: %s\n", viewCommandHint(m.runID)) } if runErr != nil {