forked from chajadan/DragonflyRules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sh.py
33 lines (28 loc) · 975 Bytes
/
sh.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
from dragonfly import *
import BaseGrammars
from BaseRules import *
grammar_context = AppContext(executable = "sh")
grammar = BaseGrammars.GlobalGrammar("sh", context = grammar_context)
class GitBashRules(QuickRules):
context= AppContext(title = "MINGW32"),
name="GitBashRules"
mapping = {
"add all": Text("git add .") + Key("enter"),
"add all with deletes": Text("git add -A") + Key("enter"),
"status": Text("git status") + Key("enter"),
"diff": Text("git diff") + Key("enter"),
"commit": Text("git commit"),
"commit [with] message <text>": {
"action": Text('git commit -m "%(text)s"'),
"intro": ["commit message", "commit with message"]},
"push": Text("git push") + Key("enter"),
}
extrasDict = {
"text": Dictation("text"),
}
GitBashRules(grammar)
grammar.load()
def unload():
global grammar
if grammar: grammar.unload()
grammar = None