Skip to content

Commit

Permalink
Merge branch 'main' into branchcreatetimeouterror
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyangyu authored Sep 24, 2024
2 parents 1dad5a5 + 948d010 commit c3f0b9d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions internal/cli/upgrade/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ func Cmd(h *internal.Helper) *cobra.Command {
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
ctx := cmd.Context()
// If is managed by TiUP, we should disable the update command since binpath is different.
// If is managed by TiUP, we should disable the upgrade command since binpath is different.
if config.IsUnderTiUP {
return errors.New("the CLI is managed by TiUP, please update it by `tiup update cloud`")
return errors.New("the CLI is managed by TiUP, please upgrade it by `tiup update cloud`")
}

// When update CLI, we don't need to check the version again after command executes.
// When upgrade CLI, we don't need to check the version again after command executes.
newRelease, err := github.CheckForUpdate(ctx, false)
// If we can't get the latest version, we should update the CLI assuming it's not the latest version.
// If we can't get the latest version, we should upgrade the CLI assuming it's not the latest version.
if err != nil {
log.Debug("Failed to check for update, update the CLI assuming it's not the latest version", zap.Error(err))
log.Debug("Failed to check for upgrade, upgrade the CLI assuming it's not the latest version", zap.Error(err))
newRelease = &github.ReleaseInfo{
Version: "latest",
}
Expand All @@ -74,7 +74,7 @@ func Cmd(h *internal.Helper) *cobra.Command {
}

func updateAndWaitReady(ctx context.Context, h *internal.Helper, newRelease *github.ReleaseInfo) error {
fmt.Fprintf(h.IOStreams.Out, "... Updating the CLI to version %s\n", newRelease.Version)
fmt.Fprintf(h.IOStreams.Out, "... Upgrading the CLI to version %s\n", newRelease.Version)

ctx, cancel := context.WithTimeout(ctx, 1*time.Minute)
defer cancel()
Expand Down Expand Up @@ -160,7 +160,7 @@ func updateAndSpinnerWait(ctx context.Context, h *internal.Helper, newRelease *g
if err != nil {
return err
} else {
return ui.Result("Update successfully!")
return ui.Result("Upgrade successfully!")
}
case <-ctx.Done():
return util.InterruptError
Expand All @@ -170,7 +170,7 @@ func updateAndSpinnerWait(ctx context.Context, h *internal.Helper, newRelease *g
}
}

p := tea.NewProgram(ui.InitialSpinnerModel(task, fmt.Sprintf("Updating the CLI to version %s", newRelease.Version)))
p := tea.NewProgram(ui.InitialSpinnerModel(task, fmt.Sprintf("Upgrading the CLI to version %s", newRelease.Version)))
model, err := p.Run()
if err != nil {
return errors.Trace(err)
Expand Down

0 comments on commit c3f0b9d

Please sign in to comment.