Skip to content

Commit 71552ea

Browse files
committed
install/uninstall: set program name in proper place
1 parent 65703f0 commit 71552ea

File tree

3 files changed

+3
-13
lines changed

3 files changed

+3
-13
lines changed

cli/cmd/install.go

-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ func newInstallTtCmd() *cobra.Command {
1717
Short: "Install tt",
1818
Run: func(cmd *cobra.Command, args []string) {
1919
cmdCtx.CommandName = cmd.Name()
20-
installCtx.ProgramName = cmd.Name()
2120
err := modules.RunCmd(&cmdCtx, cmd.CommandPath(), &modulesInfo,
2221
internalInstallModule, args)
2322
util.HandleCmdErr(cmd, err)
@@ -34,7 +33,6 @@ func newInstallTarantoolCmd() *cobra.Command {
3433
Short: "Install tarantool community edition",
3534
Run: func(cmd *cobra.Command, args []string) {
3635
cmdCtx.CommandName = cmd.Name()
37-
installCtx.ProgramName = cmd.Name()
3836
err := modules.RunCmd(&cmdCtx, cmd.CommandPath(), &modulesInfo,
3937
internalInstallModule, args)
4038
util.HandleCmdErr(cmd, err)
@@ -56,7 +54,6 @@ func newInstallTarantoolEeCmd() *cobra.Command {
5654
Short: "Install tarantool enterprise edition",
5755
Run: func(cmd *cobra.Command, args []string) {
5856
cmdCtx.CommandName = cmd.Name()
59-
installCtx.ProgramName = cmd.Name()
6057
err := modules.RunCmd(&cmdCtx, cmd.CommandPath(), &modulesInfo,
6158
internalInstallModule, args)
6259
util.HandleCmdErr(cmd, err)
@@ -81,7 +78,6 @@ func newInstallTarantoolDevCmd() *cobra.Command {
8178
" tt run # runs the binary compiled above",
8279
Run: func(cmd *cobra.Command, args []string) {
8380
cmdCtx.CommandName = cmd.Name()
84-
installCtx.ProgramName = cmd.Name()
8581
err := modules.RunCmd(&cmdCtx, cmd.CommandPath(), &modulesInfo,
8682
internalInstallModule, args)
8783
util.HandleCmdErr(cmd, err)

cli/cmd/uninstall.go

+1-8
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,13 @@ import (
1010
"github.com/tarantool/tt/cli/util"
1111
)
1212

13-
var (
14-
programName string
15-
)
16-
1713
// newUninstallTtCmd creates a command to install tt.
1814
func newUninstallTtCmd() *cobra.Command {
1915
var tntCmd = &cobra.Command{
2016
Use: "tt [version]",
2117
Short: "Uninstall tt",
2218
Run: func(cmd *cobra.Command, args []string) {
2319
cmdCtx.CommandName = cmd.Name()
24-
programName = cmd.Name()
2520
err := modules.RunCmd(&cmdCtx, cmd.CommandPath(), &modulesInfo,
2621
InternalUninstallModule, args)
2722
util.HandleCmdErr(cmd, err)
@@ -48,7 +43,6 @@ func newUninstallTarantoolCmd() *cobra.Command {
4843
Short: "Uninstall tarantool community edition",
4944
Run: func(cmd *cobra.Command, args []string) {
5045
cmdCtx.CommandName = cmd.Name()
51-
programName = cmd.Name()
5246
err := modules.RunCmd(&cmdCtx, cmd.CommandPath(), &modulesInfo,
5347
InternalUninstallModule, args)
5448
util.HandleCmdErr(cmd, err)
@@ -75,7 +69,6 @@ func newUninstallTarantoolEeCmd() *cobra.Command {
7569
Short: "Uninstall tarantool enterprise edition",
7670
Run: func(cmd *cobra.Command, args []string) {
7771
cmdCtx.CommandName = cmd.Name()
78-
programName = cmd.Name()
7972
err := modules.RunCmd(&cmdCtx, cmd.CommandPath(), &modulesInfo,
8073
InternalUninstallModule, args)
8174
util.HandleCmdErr(cmd, err)
@@ -102,7 +95,6 @@ func newUninstallTarantoolDevCmd() *cobra.Command {
10295
Short: "Uninstall tarantool-dev",
10396
Run: func(cmd *cobra.Command, args []string) {
10497
cmdCtx.CommandName = cmd.Name()
105-
programName = cmd.Name()
10698
err := modules.RunCmd(&cmdCtx, cmd.CommandPath(), &modulesInfo,
10799
InternalUninstallModule, args)
108100
util.HandleCmdErr(cmd, err)
@@ -139,6 +131,7 @@ func InternalUninstallModule(cmdCtx *cmdcontext.CmdCtx, args []string) error {
139131
return errNoConfig
140132
}
141133

134+
programName := cmdCtx.CommandName
142135
programVersion := ""
143136
if len(args) == 1 {
144137
programVersion = args[0]

cli/install/install.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1591,10 +1591,11 @@ func Install(binDir string, includeDir string, installCtx InstallCtx,
15911591
}
15921592

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

1597-
if cmdCtx.CommandName == search.ProgramDev {
1598+
if installCtx.ProgramName == search.ProgramDev {
15981599
if len(args) != 1 {
15991600
return fmt.Errorf("exactly one build directory must be specified")
16001601
}

0 commit comments

Comments
 (0)