support "$$" as a literal "$" in alias arg replacements
This commit is contained in:
parent
6e005f1569
commit
352df0fa75
1 changed files with 17 additions and 15 deletions
|
@ -7,6 +7,8 @@ SETTING_PREFIX = "command-alias-"
|
|||
|
||||
class Module(ModuleManager.BaseModule):
|
||||
def _arg_replace(self, s, args_split):
|
||||
parts = s.split("$$")
|
||||
for i, part in enumerate(parts):
|
||||
for match in REGEX_ARG_NUMBER.finditer(s):
|
||||
if match.group(1):
|
||||
index = int(match.group(1))
|
||||
|
@ -21,8 +23,8 @@ class Module(ModuleManager.BaseModule):
|
|||
replace = " ".join(args_split[index:])
|
||||
else:
|
||||
replace = args_split[index]
|
||||
s = s.replace(match.group(0), replace)
|
||||
return s
|
||||
parts[i] = part.replace(match.group(0), replace)
|
||||
return "$".join(parts)
|
||||
|
||||
def _get_alias(self, server, target, command):
|
||||
setting = "%s%s" % (SETTING_PREFIX, command)
|
||||
|
|
Loading…
Reference in a new issue