2013-01-21 20:42:57 +01:00
|
|
|
#!/usr/bin/env python
|
2013-04-13 16:51:49 +02:00
|
|
|
# vim:fileencoding=utf-8:noet
|
2014-08-31 20:55:26 +02:00
|
|
|
|
|
|
|
from __future__ import (unicode_literals, division, absolute_import, print_function)
|
|
|
|
|
2013-01-22 08:04:26 +01:00
|
|
|
import sys
|
2013-03-24 01:09:39 +01:00
|
|
|
import os
|
2012-11-26 16:16:39 +01:00
|
|
|
|
2013-01-16 09:00:19 +01:00
|
|
|
try:
|
2014-10-25 14:00:32 +02:00
|
|
|
from powerline.shell import ShellPowerline
|
2013-01-16 09:00:19 +01:00
|
|
|
except ImportError:
|
2014-02-15 22:25:10 +01:00
|
|
|
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(os.path.realpath(__file__)))))
|
2014-10-25 14:00:32 +02:00
|
|
|
from powerline.shell import ShellPowerline
|
2014-08-02 18:35:23 +02:00
|
|
|
|
2014-10-25 14:00:32 +02:00
|
|
|
from powerline.commands.main import get_argparser, finish_args, write_output
|
2014-09-16 18:51:39 +02:00
|
|
|
from powerline.lib.unicode import get_preferred_output_encoding
|
|
|
|
|
2013-01-10 19:55:18 +01:00
|
|
|
|
2014-08-27 19:44:29 +02:00
|
|
|
if sys.version_info < (3,):
|
|
|
|
write = sys.stdout.write
|
|
|
|
else:
|
|
|
|
write = sys.stdout.buffer.write
|
2014-06-23 06:39:05 +02:00
|
|
|
|
2014-08-02 18:35:23 +02:00
|
|
|
|
2013-01-10 19:55:18 +01:00
|
|
|
if __name__ == '__main__':
|
2014-10-25 14:00:32 +02:00
|
|
|
args = get_argparser().parse_args()
|
2015-01-06 20:05:51 +01:00
|
|
|
finish_args(os.environ, args)
|
2013-03-31 22:01:51 +02:00
|
|
|
powerline = ShellPowerline(args, run_once=True)
|
2013-05-06 17:13:31 +02:00
|
|
|
segment_info = {'args': args, 'environ': os.environ}
|
2014-09-16 18:51:39 +02:00
|
|
|
write_output(args, powerline, segment_info, write, get_preferred_output_encoding())
|