aboutsummaryrefslogtreecommitdiff
path: root/testfiles/commands.txt
diff options
context:
space:
mode:
authorPetter Rodhelind <petter.rodhelind@gmail.com>2018-02-22 23:15:13 +0100
committerPetter Rodhelind <petter.rodhelind@gmail.com>2018-02-22 23:15:13 +0100
commit4bca49f807544bd948a5f5f78e3787411252650f (patch)
tree5014acfd25b349488fd8116dccccac714bedb65d /testfiles/commands.txt
downloadpoe-4bca49f807544bd948a5f5f78e3787411252650f.tar.gz
poe-4bca49f807544bd948a5f5f78e3787411252650f.tar.bz2
poe-4bca49f807544bd948a5f5f78e3787411252650f.zip
first commit
Diffstat (limited to 'testfiles/commands.txt')
-rw-r--r--testfiles/commands.txt48
1 files changed, 48 insertions, 0 deletions
diff --git a/testfiles/commands.txt b/testfiles/commands.txt
new file mode 100644
index 0000000..96b49c0
--- /dev/null
+++ b/testfiles/commands.txt
@@ -0,0 +1,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("?")
+ }
+}