Skip to content

Commit

Permalink
install/uninstall: set program name in proper place
Browse files Browse the repository at this point in the history
  • Loading branch information
elhimov committed Dec 27, 2024
1 parent 05eaca4 commit 8a500f1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
4 changes: 0 additions & 4 deletions cli/cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ func newInstallTtCmd() *cobra.Command {
Short: "Install tt",
Run: func(cmd *cobra.Command, args []string) {
cmdCtx.CommandName = cmd.Name()
installCtx.ProgramName = cmd.Name()
err := modules.RunCmd(&cmdCtx, cmd.CommandPath(), &modulesInfo,
internalInstallModule, args)
util.HandleCmdErr(cmd, err)
Expand All @@ -34,7 +33,6 @@ func newInstallTarantoolCmd() *cobra.Command {
Short: "Install tarantool community edition",
Run: func(cmd *cobra.Command, args []string) {
cmdCtx.CommandName = cmd.Name()
installCtx.ProgramName = cmd.Name()
err := modules.RunCmd(&cmdCtx, cmd.CommandPath(), &modulesInfo,
internalInstallModule, args)
util.HandleCmdErr(cmd, err)
Expand All @@ -56,7 +54,6 @@ func newInstallTarantoolEeCmd() *cobra.Command {
Short: "Install tarantool enterprise edition",
Run: func(cmd *cobra.Command, args []string) {
cmdCtx.CommandName = cmd.Name()
installCtx.ProgramName = cmd.Name()
err := modules.RunCmd(&cmdCtx, cmd.CommandPath(), &modulesInfo,
internalInstallModule, args)
util.HandleCmdErr(cmd, err)
Expand All @@ -81,7 +78,6 @@ func newInstallTarantoolDevCmd() *cobra.Command {
" tt run # runs the binary compiled above",
Run: func(cmd *cobra.Command, args []string) {
cmdCtx.CommandName = cmd.Name()
installCtx.ProgramName = cmd.Name()
err := modules.RunCmd(&cmdCtx, cmd.CommandPath(), &modulesInfo,
internalInstallModule, args)
util.HandleCmdErr(cmd, err)
Expand Down
9 changes: 1 addition & 8 deletions cli/cmd/uninstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,13 @@ import (
"github.com/tarantool/tt/cli/util"
)

var (
programName string
)

// newUninstallTtCmd creates a command to install tt.
func newUninstallTtCmd() *cobra.Command {
var tntCmd = &cobra.Command{
Use: "tt [version]",
Short: "Uninstall tt",
Run: func(cmd *cobra.Command, args []string) {
cmdCtx.CommandName = cmd.Name()
programName = cmd.Name()
err := modules.RunCmd(&cmdCtx, cmd.CommandPath(), &modulesInfo,
InternalUninstallModule, args)
util.HandleCmdErr(cmd, err)
Expand All @@ -48,7 +43,6 @@ func newUninstallTarantoolCmd() *cobra.Command {
Short: "Uninstall tarantool community edition",
Run: func(cmd *cobra.Command, args []string) {
cmdCtx.CommandName = cmd.Name()
programName = cmd.Name()
err := modules.RunCmd(&cmdCtx, cmd.CommandPath(), &modulesInfo,
InternalUninstallModule, args)
util.HandleCmdErr(cmd, err)
Expand All @@ -75,7 +69,6 @@ func newUninstallTarantoolEeCmd() *cobra.Command {
Short: "Uninstall tarantool enterprise edition",
Run: func(cmd *cobra.Command, args []string) {
cmdCtx.CommandName = cmd.Name()
programName = cmd.Name()
err := modules.RunCmd(&cmdCtx, cmd.CommandPath(), &modulesInfo,
InternalUninstallModule, args)
util.HandleCmdErr(cmd, err)
Expand All @@ -102,7 +95,6 @@ func newUninstallTarantoolDevCmd() *cobra.Command {
Short: "Uninstall tarantool-dev",
Run: func(cmd *cobra.Command, args []string) {
cmdCtx.CommandName = cmd.Name()
programName = cmd.Name()
err := modules.RunCmd(&cmdCtx, cmd.CommandPath(), &modulesInfo,
InternalUninstallModule, args)
util.HandleCmdErr(cmd, err)
Expand Down Expand Up @@ -139,6 +131,7 @@ func InternalUninstallModule(cmdCtx *cmdcontext.CmdCtx, args []string) error {
return errNoConfig
}

programName := cmdCtx.CommandName
programVersion := ""
if len(args) == 1 {
programVersion = args[0]
Expand Down
3 changes: 2 additions & 1 deletion cli/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -1591,10 +1591,11 @@ func Install(binDir string, includeDir string, installCtx InstallCtx,
}

func FillCtx(cmdCtx *cmdcontext.CmdCtx, installCtx *InstallCtx, args []string) error {
installCtx.ProgramName = cmdCtx.CommandName
installCtx.verbose = cmdCtx.Cli.Verbose
installCtx.skipMasterUpdate = cmdCtx.Cli.NoPrompt

if cmdCtx.CommandName == search.ProgramDev {
if installCtx.ProgramName == search.ProgramDev {
if len(args) != 1 {
return fmt.Errorf("exactly one build directory must be specified")
}
Expand Down

0 comments on commit 8a500f1

Please sign in to comment.