-
Notifications
You must be signed in to change notification settings - Fork 0
/
linux.py
115 lines (94 loc) · 2.35 KB
/
linux.py
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
111
112
113
114
115
from dvc import *
# linux.cmd = { "svn " : "S. V. N.",
# "ssh" : "S. S. H.",
# "git " : "",
# "diff " : "",
# "make " : "",
# "emacs" : "",
# "apt-get " : "apt get",
# "apt-cache " : "apt cache",
# "tar xf " : "tar X. F.",
# "cd " : "C. D.",
# "cd -" : "cd minus",
# "grep -r " : "grep R.",
# "fg {Enter}" : "G. F.",
# "sudo " : "",
# "ln -s " : "L. N. S.",
# "tail -f " : "tail F.",
# "rm " : "R. M."
# }
# linux.dir = { "mkdir " : "make",
# "ls " : "list",
# "cd " : "change" }
# linux["make"] = [ "clean", "install", "upload" ]
# linux["svn"] = [ "add", "move", "remove",
# "commit", "checkout", "update", "up"
# "diff", "status", "log"
# ]
# linux.pipe = [ "grep", "less", "head", "xargs", "cat", "tail", "awk" ]
# for (k,v) in linux.cmd.items(): script.append((v or k, k))
# for (k,v) in linux.items():
# voice = linux.cmd.get(k + " ", None) or linux.cmd.get(k,k) or k
# script.append(List(k, v))
# script.append(("%s <%s>" % (voice,k), [k + " ", Argument(0), " "]))
# script.append(List("dir", linux.dir.values()))
# script.append(("<dir> dir",
# Var("cmd", Argument(0)),
# Transform(Var("cmd"), linux.dir), Var("cmd")))
# script.append(List("pipe", linux.pipe))
# script.append(("pipe <pipe>", ["| ", Argument(0)]))
dvc = DVC(
"terminal-linux.dvc",
Keys("equal quotes", '=""{Left}'),
Keys("dollar parens", '$(){Left}'),
List("commands",
"ssh",
"make",
"cmake",
"sudo",
"grep",
"less",
"head",
"tail",
"emacs",
"valgrind",
"gdb",
"tmux"
),
Script("<commands>", '_arg1 + " "'),
List("apt-get", "remove", "install", "update", "upgrade"),
Script("apt-get <apt-get>", '"apt-get " + _arg1 + " "'),
)
git = [
"",
"fetch",
"fetch --all",
"log",
"clone",
"branch",
"commit",
"commit --amend",
"commit --all",
"add",
"push",
"push --force",
"pull",
"checkout",
"checkout --force",
"diff",
"reset",
"reset --hard",
"show",
"rebase",
"rebase --continue",
"rebase --abort",
"stash",
"stash apply",
"stash pop",
"cherry-pick"
]
for cmd in git:
cmd = "git %s " % cmd
voice = cmd.replace("--", "")
dvc.append(Keys(voice, cmd))
print dvc