summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2011-11-18 23:35:28 +0100
committermathieui <mathieui@mathieui.net>2011-11-18 23:35:28 +0100
commit158692fa99ad2f5ef33d846ef4a3fed78f6ee56f (patch)
tree3fbddc1a7ed23fa52d92bed2092b8611de2d25a3 /plugins
parent9361b12ce280217e8ff17facd60d7e89e7b82eee (diff)
downloadpoezio-158692fa99ad2f5ef33d846ef4a3fed78f6ee56f.tar.gz
poezio-158692fa99ad2f5ef33d846ef4a3fed78f6ee56f.tar.bz2
poezio-158692fa99ad2f5ef33d846ef4a3fed78f6ee56f.tar.xz
poezio-158692fa99ad2f5ef33d846ef4a3fed78f6ee56f.zip
Use the new args parser in the alias plugin
Diffstat (limited to 'plugins')
-rw-r--r--plugins/alias.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/plugins/alias.py b/plugins/alias.py
index eb596332..2517e2b9 100644
--- a/plugins/alias.py
+++ b/plugins/alias.py
@@ -1,4 +1,6 @@
from plugin import BasePlugin
+import common
+from common import parse_command_args_to_alias as parse
class Plugin(BasePlugin):
def init(self):
@@ -7,19 +9,20 @@ class Plugin(BasePlugin):
self.commands = {}
def command_alias(self, line):
- arg = line.split()
+ arg = common.shell_split(line)
if len(arg) < 2:
self.core.information('Alias: Not enough parameters', 'Error')
return
alias = arg[0]
- command = arg[1]
- post_args = ' '.join(arg[2:])
+ tmp_args = common.shell_split(arg[1])
+ command = tmp_args.pop(0)
+ tmp_args = arg[1][len(command)+1:]
if alias in self.core.commands or alias in self.commands:
self.core.information('Alias: command already exists', 'Error')
return
- self.commands[alias] = lambda args: self.get_command(command)(post_args+args)
- self.add_command(alias, self.commands[alias], 'This command is an alias for /%s %s' % (command, post_args))
+ self.commands[alias] = lambda args: self.get_command(command)(parse(common.shell_split(args), tmp_args))
+ self.add_command(alias, self.commands[alias], 'This command is an alias for /%s %s' %( command, tmp_args))
self.core.information('Alias /%s successfuly created' % alias, 'Info')
def command_unalias(self, alias):