-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathcmd.go
110 lines (94 loc) · 1.56 KB
/
cmd.go
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
package gomux
import "fmt"
type killSession struct {
t string
}
func (this killSession) String() string {
return fmt.Sprintf("tmux kill-session -t \"%s\" > /dev/null 2>&1\n", this.t)
}
type newSession struct {
d bool
s string
n string
c string
}
func (this newSession) String() string {
cmd := "tmux new-session"
if this.d == true {
cmd += " -d"
}
if this.s != "" {
cmd += " -s \"" + this.s + "\""
}
if this.n != "" {
cmd += " -n " + this.n
}
if this.c != "" {
cmd += " -c " + this.c
}
return cmd + "\n"
}
type splitWindow struct {
h bool
v bool
t string
c string
}
func (this splitWindow) String() string {
cmd := "tmux split-window"
if this.h == true {
cmd += " -h"
}
if this.v == true {
cmd += " -v"
}
if this.t != "" {
cmd += " -t \"" + this.t + "\""
}
if this.c != "" {
cmd += " -c " + this.c
}
return cmd + "\n"
}
type newWindow struct {
t string
n string
c string
}
func (this newWindow) String() string {
cmd := "tmux new-window"
if this.t != "" {
cmd += " " + this.t
}
if this.n != "" {
cmd += " -n \"" + this.n + "\""
}
if this.c != "" {
cmd += " -c " + this.c
}
return cmd + "\n"
}
type renameWindow struct {
t string
n string
}
func (this renameWindow) String() string {
cmd := "tmux rename-window"
if this.t != "" {
cmd += " " + this.t
}
if this.n != "" {
cmd += " \"" + this.n + "\""
}
return cmd + "\n"
}
type selectWindow struct {
t string
}
func (this selectWindow) String() string {
cmd := "tmux select-window"
if this.t != "" {
cmd += " -t \"" + this.t + "\""
}
return cmd + "\n"
}