Skip to content

Commit

Permalink
feat: add proc control to command pallet
Browse files Browse the repository at this point in the history
  • Loading branch information
F1bonacc1 committed Sep 30, 2024
1 parent 132d596 commit b245a4b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
10 changes: 0 additions & 10 deletions src/tui/proc-table.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,16 +181,6 @@ func (pv *pcView) createProcTable() *tview.Table {

table.Select(1, 1).SetFixed(1, 0).SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
switch event.Key() {
case pv.shortcuts.ShortCutKeys[ActionProcessStop].key:
name := pv.getSelectedProcName()
go pv.handleProcessStopped(name)
case pv.shortcuts.ShortCutKeys[ActionProcessStart].key:
pv.startProcess()
pv.showPassIfNeeded()
case pv.shortcuts.ShortCutKeys[ActionProcessRestart].key:
name := pv.getSelectedProcName()
pv.project.RestartProcess(name)
pv.showPassIfNeeded()
case tcell.KeyRune:
if event.Rune() == 'S' {
pv.setTableSorter(ProcessStateStatus)
Expand Down
13 changes: 13 additions & 0 deletions src/tui/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,19 @@ func (pv *pcView) setShortCutsActions() {
pv.showError(err.Error())
}
})
pv.shortcuts.setAction(ActionProcessStop, func() {
name := pv.getSelectedProcName()
go pv.handleProcessStopped(name)
})
pv.shortcuts.setAction(ActionProcessStart, func() {
pv.startProcess()
pv.showPassIfNeeded()
})
pv.shortcuts.setAction(ActionProcessRestart, func() {
name := pv.getSelectedProcName()
pv.project.RestartProcess(name)
pv.showPassIfNeeded()
})
}

func (pv *pcView) setFullScreen(isFullScreen bool) {
Expand Down

0 comments on commit b245a4b

Please sign in to comment.