mirror of
https://github.com/powerline/powerline.git
synced 2025-07-29 16:55:07 +02:00
Improve powerline-config help and require --shell argument
This commit is contained in:
parent
fadd1eec17
commit
e58aa8f62d
@ -6,14 +6,26 @@ import argparse
|
|||||||
import powerline.bindings.config as config
|
import powerline.bindings.config as config
|
||||||
|
|
||||||
|
|
||||||
|
class StrFunction(object):
|
||||||
|
def __init__(self, function, name=None):
|
||||||
|
self.name = name or function.__name__
|
||||||
|
self.function = function
|
||||||
|
|
||||||
|
def __call__(self, *args, **kwargs):
|
||||||
|
self.function(*args, **kwargs)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
|
||||||
TMUX_ACTIONS = {
|
TMUX_ACTIONS = {
|
||||||
'source': config.source_tmux_files,
|
'source': StrFunction(config.source_tmux_files, 'source'),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SHELL_ACTIONS = {
|
SHELL_ACTIONS = {
|
||||||
'command': config.shell_command,
|
'command': StrFunction(config.shell_command, 'command'),
|
||||||
'uses': config.uses,
|
'uses': StrFunction(config.uses),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -56,7 +68,7 @@ def get_argparser(ArgumentParser=ConfigArgParser):
|
|||||||
)
|
)
|
||||||
shell_parser.add_argument(
|
shell_parser.add_argument(
|
||||||
'-s', '--shell',
|
'-s', '--shell',
|
||||||
nargs='?',
|
metavar='SHELL',
|
||||||
help='Shell for which query is run',
|
help='Shell for which query is run',
|
||||||
)
|
)
|
||||||
return parser
|
return parser
|
||||||
|
Loading…
x
Reference in New Issue
Block a user