Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tiup: install --force to reinstall #1145

Merged
merged 3 commits into from
Feb 22, 2021
Merged
Changes from 1 commit
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
8 changes: 3 additions & 5 deletions cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
)

func newInstallCmd() *cobra.Command {
var force bool
cmd := &cobra.Command{
Use: "install <component1>[:version] [component2...N]",
Short: "Install a specific version of a component",
Expand All @@ -36,12 +37,9 @@ of the same component:
if len(args) == 0 {
return cmd.Help()
}
return installComponents(env, args)
return env.UpdateComponents(args, false, force)
},
}
cmd.Flags().BoolVar(&force, "force", false, "If the specified version was already installed, force a reinstallation")
return cmd
}

func installComponents(env *environment.Environment, specs []string) error {
return env.UpdateComponents(specs, false, false)
}