Skip to content

Commit

Permalink
lock version for local page
Browse files Browse the repository at this point in the history
  • Loading branch information
moqsien committed Jun 1, 2024
1 parent 6658af2 commit 8d97930
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .vmr.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"go": "1.22.3",
"node": "20.13.1"
"node": "20.14.0"
}
8 changes: 8 additions & 0 deletions internal/tui/cmds/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ func (v *VmrTUI) ShowLocalInstalled(sdkName string) {
case KeyEventRemoveAnInstalledVersion:
// remove the selected version.
v.RemoveSelectedVersion(sdkName, selectedVersion)
case KeyEventLockVersion:
if v.VList == nil {
v.VList = NewVersionSearcher()
}
vItem := v.VList.GetVersionByVersionName(selectedVersion)
ins := installer.NewInstaller(sdkName, selectedVersion, "", vItem)
ins.SetInvokeMode(installer.ModeToLock)
ins.Install()
}
}

Expand Down
8 changes: 8 additions & 0 deletions internal/tui/cmds/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,12 @@ func (l *LocalInstalled) RegisterKeyEvents(ll *table.List) {
},
HelpInfo: "back to previous page",
})

ll.SetKeyEventForTable("l", table.KeyEvent{
Event: func(key string, l *table.List) tea.Cmd {
l.NextEvent = KeyEventLockVersion
return tea.Quit
},
HelpInfo: "lock the selected version for curret project",
})
}

0 comments on commit 8d97930

Please sign in to comment.