mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 19:52:54 +01:00
Added new pipe syntax to check for recursive aliases.
This commit is contained in:
parent
e0fae30f46
commit
ffefdf1ab7
@ -93,7 +93,8 @@ class RecursiveAlias(Exception):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def findAliasCommand(s, alias):
|
def findAliasCommand(s, alias):
|
||||||
r = re.compile(r'(^|\[)\s*%s' % re.escape(s))
|
s = re.escape(s)
|
||||||
|
r = re.compile(r'(?:(^|\[)\s*%s|\|\s*%s)' % (s, s))
|
||||||
return bool(r.search(alias))
|
return bool(r.search(alias))
|
||||||
|
|
||||||
dollarRe = re.compile(r'\$(\d+)')
|
dollarRe = re.compile(r'\$(\d+)')
|
||||||
|
@ -47,6 +47,8 @@ class FunctionsTest(unittest.TestCase):
|
|||||||
self.failUnless(Alias.findAliasCommand(s, '[ %s]' % s))
|
self.failUnless(Alias.findAliasCommand(s, '[ %s]' % s))
|
||||||
self.failUnless(Alias.findAliasCommand(s, 'foo bar [%s]' % s))
|
self.failUnless(Alias.findAliasCommand(s, 'foo bar [%s]' % s))
|
||||||
self.failUnless(Alias.findAliasCommand(s, 'foo bar [ %s]' % s))
|
self.failUnless(Alias.findAliasCommand(s, 'foo bar [ %s]' % s))
|
||||||
|
self.failUnless(Alias.findAliasCommand(s, 'foo | %s' % s))
|
||||||
|
self.failUnless(Alias.findAliasCommand(s, 'foo |%s' % s))
|
||||||
|
|
||||||
def testFindBiggestDollar(self):
|
def testFindBiggestDollar(self):
|
||||||
self.assertEqual(Alias.findBiggestDollar(''), None)
|
self.assertEqual(Alias.findBiggestDollar(''), None)
|
||||||
|
Loading…
Reference in New Issue
Block a user