File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 2
2
from biplist import *
3
3
import json
4
4
import os
5
+ import re
5
6
6
7
class SourceTree :
7
8
8
9
homePath = os .path .expanduser ('~' )
9
10
filePath = homePath + "/Library/Application Support/SourceTree/browser.plist"
10
11
12
+ def _camel_case_split (self , identifier ):
13
+ matches = re .finditer ('.+?(?:(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])|$)' , identifier )
14
+ return [m .group (0 ) for m in matches ]
15
+
16
+ def _splitMatchWords (self , title ):
17
+ res = []
18
+ cam = self ._camel_case_split (title )
19
+ for m in cam :
20
+ ret = re .split ('-|_| |' ,m )
21
+ for n in ret :
22
+ res .append (n )
23
+ return ' ' .join (res );
24
+
11
25
def _getProjects (self ):
12
26
try :
13
27
plist = readPlist (self .filePath )
@@ -29,7 +43,8 @@ def getList(self):
29
43
item = {
30
44
'title' : p [0 ],
31
45
'subtitle' : p [1 ],
32
- 'arg' : p [1 ]
46
+ 'arg' : p [1 ],
47
+ 'match' : self ._splitMatchWords (p [0 ])
33
48
}
34
49
items .append (item )
35
50
result = {'items' : items }
You can’t perform that action at this time.
0 commit comments