blob: 96b49c040f7bcb325a09715f45d60c092994cad0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
assadfsadfpackage main
import (
"fmt"
"os/exec"
"strings"
)
func toggleCmdline() {
if !ctrlWin.focused {
ctrlWin.visible = true
ctrlWin.SetFocus(true)
CurWin().SetFocus(false)
return
}
ctrlWin.visible = false
ctrlWin.SetFocus(false)
CurWin().SetFocus(true)
// TODO: should call some sort of ResizeAll here...
screen.Clear()
screen.Sync()
}
func parseCmd(input []byte) {
if len(input) < 1 {
return
}
switch input[0] {
case 'f':
var names []string
for _, win := range AllWindows() {
names = append(names, fmt.Sprintf(" %3s %s", win.Flags(), win.Name()))
}
printMsg(strings.Join(names, "\n"))
case '!':
cmd := strings.Split(string(input[1:]), " ")
out, err := exec.Command(cmd[0], cmd[1:]...).Output()
if err != nil {
printMsg("error: %s", err)
break
}
printMsg("%s", out)
default:
printMsg("?")
}
}
|