Alias module: handle special variable like $1, $2, ...
This commit is contained in:
parent
85fb612475
commit
073f34af26
@ -99,9 +99,16 @@ def cmd_unalias(msg):
|
||||
|
||||
def replace_variables(cnt, msg=None):
|
||||
cnt = cnt.split(' ')
|
||||
unsetCnt = list()
|
||||
for i in range(0, len(cnt)):
|
||||
res = re.match("^([^a-zA-Z0-9]*)(\\\\)\\$([a-zA-Z0-9]+)(.*)$", cnt[i])
|
||||
if i not in unsetCnt:
|
||||
res = re.match("^([^$]*)(\\\\)?\\$([a-zA-Z0-9]+)(.*)$", cnt[i])
|
||||
if res is not None:
|
||||
try:
|
||||
varI = int(res.group(3))
|
||||
unsetCnt.append(varI)
|
||||
cnt[i] = res.group(1) + msg.cmds[varI] + res.group(4)
|
||||
except:
|
||||
if res.group(2) != "":
|
||||
cnt[i] = res.group(1) + "$" + res.group(3) + res.group(4)
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user