Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/setup/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (m wizardModel) runInstall() tea.Cmd {
if err != nil {
// Don't dead-end the interactive flow on a failed auto-install (e.g.
// Ruby gem perms, no network): surface the command to run by hand.
args, _ := setup.InstallArgs(m.detectResult.SDKID, m.detectResult.PackageManager)
args, _ := setup.InstallArgs(dir, m.detectResult.SDKID, m.detectResult.PackageManager)
return installDoneMsg{result: &setup.InstallResult{
SDKID: m.detectResult.SDKID,
Command: strings.Join(args, " "),
Expand Down
5 changes: 4 additions & 1 deletion cmd/setup/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func runInstall(svc setup.Service) func(*cobra.Command, []string) error {

var result *setup.InstallResult
if dryRun {
args, pkg := setup.InstallArgs(sdkID, pkgMgr)
args, pkg := setup.InstallArgs(dir, sdkID, pkgMgr)
result = &setup.InstallResult{
SDKID: sdkID,
Package: pkg,
Expand Down Expand Up @@ -95,6 +95,9 @@ func runInstall(svc setup.Service) func(*cobra.Command, []string) error {
return nil
}
fmt.Fprintf(cmd.OutOrStdout(), "Success: %t\n", result.Success)
if result.Warning != "" {
fmt.Fprintf(cmd.OutOrStdout(), "Warning: %s\n", result.Warning)
}
switch {
case result.FailureReason != "":
fmt.Fprintf(cmd.OutOrStdout(), "Reason: %s\n", result.FailureReason)
Expand Down
10 changes: 6 additions & 4 deletions cmd/setup/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,13 @@ func (m wizardModel) handleEnter() (tea.Model, tea.Cmd) {
}
}
m.detectResult = &result
// Compute the plan preview shown before any action is taken.
args, _ := setup.InstallArgs(chosen.id, result.PackageManager)
// Compute the plan preview shown before any action is taken. It is resolved
// against the project directory so the previewed command is the one that runs.
planDir, _ := os.Getwd()
args, _ := setup.InstallArgs(planDir, chosen.id, result.PackageManager)
m.planInstallCmd = strings.Join(args, " ")
if dir, err := os.Getwd(); err == nil {
m.planAlready = setup.IsInstalled(dir, chosen.id)
if planDir != "" {
m.planAlready = setup.IsInstalled(planDir, chosen.id)
}
m.step = stepPlan
return m, nil
Expand Down
5 changes: 5 additions & 0 deletions cmd/setup/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,15 @@ func (m wizardModel) View() string {
}
if m.verifyResult != nil && m.verifyResult.Active && m.detectResult != nil {
appHost := strings.TrimRight(m.auth.BaseURI, "/")
warning := ""
if m.installResult != nil && m.installResult.Warning != "" {
warning = "\n" + m.wrap("Note: "+m.installResult.Warning) + "\n"
}
return titleStyle.Render("Setup complete!") + "\n\n" +
fmt.Sprintf("Your %s SDK is connected to LaunchDarkly.\n", m.detectResult.SDKID) +
fmt.Sprintf("Flag %q is ready to use.\n\n", m.flagKey) +
fmt.Sprintf("You can now toggle your flag at %s/projects/%s/flags/%s/targeting?env=%s\n", appHost, m.selectedProject, m.flagKey, m.selectedEnv) +
warning +
quitHint
}
return titleStyle.Render("Verification timed out") + "\n\n" +
Expand Down
Loading
Loading