-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy path_git.py
61 lines (49 loc) · 1.8 KB
/
_git.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
# Created for aenea using libraries from the Dictation Toolbox
# https://github.com/dictation-toolbox/dragonfly-scripts
#
# Commands for interacting with Git
#
# Author: Tony Grosinger
#
# Licensed under LGPL
import aenea
import aenea.configuration
from aenea.lax import Key
from aenea import Text
import dragonfly
git_context = aenea.ProxyPlatformContext('linux')
grammar = dragonfly.Grammar('git', context=git_context)
git_mapping = aenea.configuration.make_grammar_commands('git', {
'git': Text("git"),
'git amend': Text("git commit --amend") + Key("enter"),
'git commit': Text("git commit") + Key("enter"),
'git pull': Text("git pull") + Key("enter"),
'git branches': Text("git branch -l") + Key("enter"),
'git status': Text("git status") + Key("enter"),
'git stat': Text("git show --stat") + Key("enter"),
'git log': Text("git log") + Key("enter"),
'git push': Text("git push") + Key("enter"),
'git diff': Text("git diff") + Key("enter"),
# https://github.com/tgrosinger/dotfiles/blob/master/.gitconfig#L15
'git hist': Text("git hist") + Key("enter"),
# Incomplete Commands
'git add': Text("git add "),
'git checkout': Text("git checkout "),
'git interactive rebase': Text("git rebase -i "),
'git rebase': Text("git rebase "),
'git push to': Text("git push"),
# SVN Commands
'git trunk': Text("git checkout trunk-svn") + Key("enter"),
'git SVN pull': Text("git svn rebase") + Key("enter"),
'git SVN rebase interactive': Text("git rebase -i trunk-svn") + Key("enter"),
'git SVN rebase': Text("git rebase trunk-svn") + Key("enter"),
})
class Mapping(dragonfly.MappingRule):
mapping = git_mapping
grammar.add_rule(Mapping())
grammar.load()
def unload():
global grammar
if grammar:
grammar.unload()
grammar = None