From ffba792a69884289c324090d2b91d4aea6a60141 Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Wed, 6 Mar 2013 10:38:24 +0800 Subject: [PATCH] Aliases can be updated --- lib/commands/alias.py | 47 ++++++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/lib/commands/alias.py b/lib/commands/alias.py index 17de90d..07e5c47 100644 --- a/lib/commands/alias.py +++ b/lib/commands/alias.py @@ -58,22 +58,6 @@ class AliasCommand(Command): ) ] ), - 'show': ( - { - 'help': 'display an alias' - }, - [ - ( - ['alias'], - { - 'type': str, - 'metavar': 'alias', - 'default': None, - 'help': 'alias to display' - } - ) - ] - ), 'add': ( { 'help': 'adds an alias' @@ -85,7 +69,7 @@ class AliasCommand(Command): 'type': str, 'metavar': 'alias', 'default': None, - 'help': 'alias to display' + 'help': 'alias name' } ), ( @@ -115,6 +99,32 @@ class AliasCommand(Command): } ) ] + ), + 'set': ( + { + 'help': 'update/add an alias' + }, + [ + ( + ['alias'], + { + 'type': str, + 'metavar': 'alias', + 'default': None, + 'help': 'alias name' + } + ), + ( + ['definition'], + { + 'type': str, + 'metavar': 'command', + 'default': None, + 'nargs': argparse.REMAINDER, + 'help': 'alias definition' + } + ) + ] ) } } @@ -136,5 +146,8 @@ class AliasCommand(Command): elif args.action == 'add': self.C.add('aliases.%s' % args.alias, ' '.join(args.definition)) + elif args.action == 'set': + self.C.set('aliases.%s' % args.alias, ' '.join(args.definition)) + elif args.action == 'remove': self.C.remove('aliases.%s' % args.alias) -- 2.11.0