Skip to content

Commit

Permalink
tiup: install --force to reinstall (#1145)
Browse files Browse the repository at this point in the history
Co-authored-by: Ti Chi Robot <71242396+ti-chi-bot@users.noreply.github.com>
Co-authored-by: SIGSEGV <gnu.crazier@gmail.com>
  • Loading branch information
3 people authored Feb 22, 2021
1 parent 405b908 commit 4052b6c
Showing 1 changed file with 3 additions and 5 deletions.
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)
}

0 comments on commit 4052b6c

Please sign in to comment.