Allow side, extension and renderer module to be specified in powerline-prompt
Refs #84.
This commit is contained in:
parent
2eb07e894e
commit
fcb07943eb
|
@ -1,13 +1,25 @@
|
||||||
#!/usr/bin/env python2
|
#!/usr/bin/env python2
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
'''Powerline terminal prompt.'''
|
'''Powerline prompt script.'''
|
||||||
|
import argparse
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from powerline.core import Powerline
|
from powerline.core import Powerline
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
from powerline.core import Powerline
|
from powerline.core import Powerline # NOQA
|
||||||
|
|
||||||
pl = Powerline('terminal')
|
parser = argparse.ArgumentParser(description=__doc__)
|
||||||
print(pl.renderer.render(None).encode('utf-8'))
|
parser.add_argument('side', nargs='?', default='all', choices=('all', 'left', 'right'))
|
||||||
|
parser.add_argument('--renderer_module', default='shell', choices=('shell', 'zsh_prompt'))
|
||||||
|
parser.add_argument('--ext', default='shell')
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
args = parser.parse_args()
|
||||||
|
pl = Powerline(ext=args.ext, renderer_module=args.renderer_module)
|
||||||
|
segments = pl.renderer.get_theme().get_segments()
|
||||||
|
if args.side != 'all':
|
||||||
|
segments = [s for s in segments if s['side'] == args.side]
|
||||||
|
print(pl.renderer.render(None, segments=segments).encode('utf-8'))
|
||||||
|
|
Loading…
Reference in New Issue