Add shell version of powerline-client

Note: this shell script is still faster then client/powerline.py. `time` reports 
      0.00, 0.01, 0.02÷0.03 for powerline, powerline.sh and powerline.py 
      respectively (run with `./client/powerline* tmux right`).

Note: does not work in busybox as env there does not support -0 argument. 
      Requires sed, id (for dash as $UID is not available there), env, printf 
      and socat. Is not currently handled by setup.py.
This commit is contained in:
ZyX 2013-11-23 13:54:23 +04:00 committed by ZyX
parent 7db428667c
commit e613beb8df
1 changed files with 13 additions and 0 deletions

13
client/powerline.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
ADDRESS="powerline-ipc-${UID:-`id -u`}"
# Warning: env -0 does not work in busybox. Consider switching to parsing
# `set` output in this case
(
for argv in "$@" ; do
printf '%s\0' "$argv"
done
env -0 | sed 's/\(\x00\)\([^\x00]\)\|^/\1--env=\2/g'
printf -- '--cwd=%s\0' "$PWD"
) | socat -t 10 - abstract-client:"$ADDRESS"