powerline/scripts/powerline-tmux

26 lines
736 B
Python
Executable File

#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''Powerline tmux statusline.'''
import argparse
import sys
try:
from powerline.core import Powerline
except ImportError:
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from powerline.core import Powerline # NOQA
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('side', nargs='?', default=None, choices=('left', 'right'))
parser.add_argument('--ext', default='tmux')
if __name__ == '__main__':
args = parser.parse_args()
powerline = Powerline(args.ext)
rendered = powerline.renderer.render(side=args.side)
try:
sys.stdout.write(rendered)
except UnicodeEncodeError:
sys.stdout.write(rendered.encode('utf-8'))