Skip to content

Commit

Permalink
fix: prompts the available list by whether to bring version.
Browse files Browse the repository at this point in the history
fix #205
  • Loading branch information
aooohan committed Apr 29, 2024
1 parent 350e67a commit cfccd60
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions cmd/commands/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,20 @@ func installCmd(ctx *cli.Context) error {
errorStore.AddAndShow(name, err)
continue
}

err = source.Install(version)
if errors.Is(err, internal.ErrNoVersionProvided) {
showAvailable, _ := pterm.DefaultInteractiveConfirm.Show(fmt.Sprintf("No %s version provided, do you want to select a version to install?", name))
if version == "" {
showAvailable, _ := pterm.DefaultInteractiveConfirm.Show(fmt.Sprintf("No %s version provided, do you want to select a version to install?", pterm.Red(name)))
if showAvailable {
err := RunSearch(name, []string{})
if err != nil {
errorStore.AddAndShow(name, err)
}
continue
}
}

if err != nil {
errorStore.AddAndShow(name, err)
continue
} else {
if err = source.Install(version); err != nil {
errorStore.AddAndShow(name, err)
continue
}
}
}
}
Expand Down

0 comments on commit cfccd60

Please sign in to comment.