Add a way to specify configuration paths to powerline-config

One still cannot override various configuration options from the command-line.
This commit is contained in:
ZyX 2014-11-29 19:08:59 +03:00
parent f3ba38e53d
commit d62336f7a2
5 changed files with 26 additions and 2 deletions

View File

@ -7,7 +7,8 @@ import sys
from powerline.config import POWERLINE_ROOT, TMUX_CONFIG_DIRECTORY
from powerline.lib.config import ConfigLoader
from powerline import generate_config_finder, load_config, create_logger, PowerlineLogger, finish_common_config, Powerline
from powerline import generate_config_finder, load_config, create_logger, PowerlineLogger, finish_common_config
from powerline.tmux import TmuxPowerline
from powerline.lib.shell import which
from powerline.bindings.tmux import TmuxVersionInfo, run_tmux_command, get_tmux_version
from powerline.lib.encoding import get_preferred_output_encoding
@ -77,7 +78,7 @@ def source_tmux_files(pl, args):
def init_color_variables(pl, args):
powerline = Powerline('tmux')
powerline = TmuxPowerline(args.config_path)
# TODO Move configuration files loading out of Powerline object and use it
# directly
powerline.update_renderer()

View File

@ -43,6 +43,7 @@ class ConfigArgParser(argparse.ArgumentParser):
def get_argparser(ArgumentParser=ConfigArgParser):
parser = ArgumentParser(description='Script used to obtain powerline configuration.')
parser.add_argument('-p', '--config_path', action='append', metavar='PATH', help='Path to configuration directory. If it is present then configuration files will only be seeked in the provided path. May be provided multiple times to search in a list of directories.')
subparsers = parser.add_subparsers()
tmux_parser = subparsers.add_parser('tmux', help='Tmux-specific commands')
tmux_parser.add_argument(

16
powerline/tmux.py Normal file
View File

@ -0,0 +1,16 @@
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
from powerline import Powerline
class TmuxPowerline(Powerline):
def init(self, config_paths):
self.paths = config_paths
return super(TmuxPowerline, self).init('tmux')
def get_config_paths(self):
if self.paths:
return self.paths
else:
return super(TmuxPowerline, self).get_config_paths()

View File

@ -0,0 +1,4 @@
echo $TMUX
exit
kill-server

View File

@ -0,0 +1,2 @@
source powerline/bindings/tmux/powerline.conf
set -g default-shell tests/shell/path/dash