Skip to content

Commit

Permalink
Fixed #5 add substring matching
Browse files Browse the repository at this point in the history
  • Loading branch information
yourtion committed Oct 16, 2017
1 parent 5ffbcd5 commit f31bc1a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion STP.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,26 @@
from biplist import *
import json
import os
import re

class SourceTree:

homePath=os.path.expanduser('~')
filePath= homePath + "/Library/Application Support/SourceTree/browser.plist"

def _camel_case_split(self, identifier):
matches = re.finditer('.+?(?:(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])|$)', identifier)
return [m.group(0) for m in matches]

def _splitMatchWords(self, title):
res = []
cam = self._camel_case_split(title)
for m in cam:
ret = re.split('-|_| |',m)
for n in ret:
res.append(n)
return ' '.join(res);

def _getProjects(self):
try:
plist = readPlist(self.filePath)
Expand All @@ -29,7 +43,8 @@ def getList(self):
item = {
'title': p[0],
'subtitle': p[1],
'arg': p[1]
'arg': p[1],
'match': self._splitMatchWords(p[0])
}
items.append(item)
result = {'items': items}
Expand Down
Binary file modified screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f31bc1a

Please sign in to comment.