mirror of
https://github.com/b-ryan/powerline-shell.git
synced 2026-09-10 07:26:28 -04:00
18 lines
530 B
Python
18 lines
530 B
Python
import subprocess
|
|
|
|
|
|
def add_ruby_version_segment():
|
|
try:
|
|
p1 = subprocess.Popen(["ruby", "-v"], stdout=subprocess.PIPE)
|
|
p2 = subprocess.Popen(["sed", "s/ (.*//"], stdin=p1.stdout, stdout=subprocess.PIPE)
|
|
version = p2.communicate()[0].rstrip()
|
|
if os.environ.has_key("GEM_HOME"):
|
|
gem = os.environ["GEM_HOME"].split("@")
|
|
if len(gem) > 1:
|
|
version += " " + gem[1]
|
|
powerline.append(version, 15, 1)
|
|
except OSError:
|
|
return
|
|
|
|
add_ruby_version_segment()
|