From a96b429b8abbea334bd01c5409644587fc7c2f26 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 18 Oct 2014 19:35:37 +0400 Subject: [PATCH 1/2] Make quotes in powerline-config --help same as in powerline --help --- scripts/powerline-config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/powerline-config b/scripts/powerline-config index d64939e4..a627eded 100755 --- a/scripts/powerline-config +++ b/scripts/powerline-config @@ -36,7 +36,7 @@ if __name__ == '__main__': choices=tuple(TMUX_ACTIONS.values()), metavar='action', type=(lambda v: TMUX_ACTIONS.get(v)), - help='If action is "source" then version-specific tmux configuration files are sourced.' + help='If action is `source\' then version-specific tmux configuration files are sourced.' ) shell_parser = subparsers.add_parser('shell', help='Shell-specific commands') @@ -45,7 +45,7 @@ if __name__ == '__main__': choices=tuple(SHELL_ACTIONS.values()), type=(lambda v: SHELL_ACTIONS.get(v)), metavar='action', - help='If action is "command" then preferred powerline command is output, if it is “uses” then powerline-config script will exit with 1 if specified component is disabled and 0 otherwise.', + help='If action is `command\' then preferred powerline command is output, if it is `uses\' then powerline-config script will exit with 1 if specified component is disabled and 0 otherwise.', ) shell_parser.add_argument( 'component', From cb877e75aba31ee4382ac300cadf436eb2a7e541 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 18 Oct 2014 20:01:22 +0400 Subject: [PATCH 2/2] Make `powerline-config` without arguments show proper message In Python-3* it used to show the following: Traceback (most recent call last): File "/usr/lib/python-exec/python3.3/powerline-config", line 66, in args.function(pl, args) AttributeError: 'Namespace' object has no attribute 'function' now it shows usage: powerline-config [-h] {tmux,shell} ... powerline-config: error: too few arguments in both python-2.7 and -3.3. Fixes #1120. --- scripts/powerline-config | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/powerline-config b/scripts/powerline-config index a627eded..8339731f 100755 --- a/scripts/powerline-config +++ b/scripts/powerline-config @@ -63,4 +63,12 @@ if __name__ == '__main__': pl = config.create_powerline_logger(args) - args.function(pl, args) + try: + function = args.function + except AttributeError: + # In Python-3* `powerline-config` (without arguments) raises + # AttributeError. I have not found any standard way to display same + # error message as in Python-2*. + parser.error('too few arguments') + else: + function(pl, args)