summaryrefslogtreecommitdiffstats
path: root/scripts/powerline-render
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 02:04:06 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 02:04:06 +0000
commita8637fe80c24fb04bf6cc8ae8459877535f1341b (patch)
tree5d263b4543e10940f5e9a79a8fe981c5a3414bd7 /scripts/powerline-render
parentInitial commit. (diff)
downloadpowerline-a8637fe80c24fb04bf6cc8ae8459877535f1341b.tar.xz
powerline-a8637fe80c24fb04bf6cc8ae8459877535f1341b.zip
Adding upstream version 2.7.upstream/2.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/powerline-render')
-rwxr-xr-xscripts/powerline-render31
1 files changed, 31 insertions, 0 deletions
diff --git a/scripts/powerline-render b/scripts/powerline-render
new file mode 100755
index 0000000..8b71b00
--- /dev/null
+++ b/scripts/powerline-render
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+# vim:fileencoding=utf-8:noet
+
+from __future__ import (unicode_literals, division, absolute_import, print_function)
+
+import sys
+import os
+
+try:
+ from powerline.shell import ShellPowerline
+except ImportError:
+ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(os.path.realpath(__file__)))))
+ from powerline.shell import ShellPowerline
+
+from powerline.commands.main import get_argparser, finish_args, write_output
+from powerline.lib.encoding import get_unicode_writer
+
+
+if sys.version_info < (3,):
+ write = sys.stdout.write
+else:
+ write = sys.stdout.buffer.write
+
+
+if __name__ == '__main__':
+ parser = get_argparser()
+ args = parser.parse_args()
+ finish_args(parser, os.environ, args)
+ powerline = ShellPowerline(args, run_once=True)
+ segment_info = {'args': args, 'environ': os.environ}
+ write_output(args, powerline, segment_info, get_unicode_writer())