We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 40507ae commit 1b87e24Copy full SHA for 1b87e24
CHANGELOG.md
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
17
manager (TCM) from the customer zone or local `distfiles` directory.
18
- `tt tcm status`: added command to check TCM runtime status (modes: `watchdog` or `interactive`).
19
- `tt tcm stop`: add command for graceful termination of TCM processes (modes: `watchdog` or `interactive`).
20
+- Add support manage installed `tcm` versions via `tt binaries` CLI.
21
22
### Changed
23
cli/binary/list.go
@@ -113,6 +113,7 @@ func ListBinaries(cmdCtx *cmdcontext.CmdCtx, cliOpts *config.CliOpts) (err error
113
search.ProgramCe,
114
search.ProgramDev,
115
search.ProgramEe,
116
+ search.ProgramTcm,
117
}
118
fmt.Println("List of installed binaries:")
119
for _, program := range programs {
cli/binary/switch.go
@@ -145,6 +145,24 @@ func switchTarantool(switchCtx SwitchCtx, enterprise bool) error {
145
return nil
146
147
148
+// switchTcm switches 'tcm' program.
149
+func switchTcm(switchCtx SwitchCtx) error {
150
+ log.Infof("Switching to %s %s.", switchCtx.Program, switchCtx.Version)
151
+ versionStr := search.ProgramTcm.String() + version.FsSeparator + switchCtx.Version
152
+ if util.IsRegularFile(filepath.Join(switchCtx.BinDir, versionStr)) {
153
+ err := util.CreateSymlink(versionStr, filepath.Join(switchCtx.BinDir,
154
+ "tcm"), true)
155
+ if err != nil {
156
+ return fmt.Errorf("failed to switch version: %s", err)
157
+ }
158
+ log.Infof("Done")
159
+ } else {
160
+ return fmt.Errorf("%s %s is not installed in current environment",
161
+ switchCtx.Program, switchCtx.Version)
162
163
+ return nil
164
+}
165
+
166
// Switch switches binaries.
167
func Switch(switchCtx SwitchCtx) error {
168
var err error
@@ -156,6 +174,8 @@ func Switch(switchCtx SwitchCtx) error {
174
err = switchTarantool(switchCtx, false)
175
case search.ProgramEe:
176
err = switchTarantool(switchCtx, true)
177
+ case search.ProgramTcm:
178
+ err = switchTcm(switchCtx)
179
default:
180
return fmt.Errorf("unknown application: %s", switchCtx.Program)
181
cli/cmd/binaries.go
@@ -14,12 +14,14 @@ var binariesSupportedPrograms = []string{
14
search.ProgramCe.String(),
15
search.ProgramEe.String(),
16
search.ProgramTt.String(),
+ search.ProgramTcm.String(),
// NewBinariesCmd creates binaries command.
func NewBinariesCmd() *cobra.Command {
binariesCmd := &cobra.Command{
- Use: "binaries",
+ Use: "binaries",
24
+ Short: "Manage installed binaries",
25
26
27
switchCmd := &cobra.Command{
@@ -41,8 +43,9 @@ You will need to choose version using arrow keys in your console.
41
43
# Switch with program and version.
42
44
45
$ tt binaries switch tarantool 2.10.4`,
- Run: RunModuleFunc(internalSwitchModule),
- Args: cobra.MatchAll(cobra.MaximumNArgs(2), binariesSwitchValidateArgs),
46
+ Run: RunModuleFunc(internalSwitchModule),
47
+ Args: cobra.MatchAll(cobra.MaximumNArgs(2), binariesSwitchValidateArgs),
48
+ ValidArgs: binariesSupportedPrograms,
49
50
listCmd := &cobra.Command{
51
Use: "list",
0 commit comments