Добавил возможность запускать sh комманду из скрипта

This commit is contained in:
rzaitov
2013-10-30 18:23:49 +04:00
parent bdd8b74fba
commit 0174a20c05
8 changed files with 97 additions and 1 deletions
+1
View File
@@ -0,0 +1 @@
+22
View File
@@ -0,0 +1,22 @@
from parser.LineParser import LineParser
import re
class ShParser(LineParser):
def parseLine(self, line):
assert line
cmdTextRegexp = r'(?P<text>.*)'
regexpSource = self.startsWithKeywordToken('sh') + cmdTextRegexp
regexp = re.compile(regexpSource, re.UNICODE)
match = regexp.match(line)
self._guardMatch(match, line, regexpSource)
cmdText = match.group('text')
return cmdText
def isValidLine(self, line):
assert line is not None
return line.startswith('sh ')