mirror of
https://github.com/b-ryan/powerline-shell.git
synced 2026-09-10 07:26:28 -04:00
Merge 05ee16cfc7 into 4b19aa47f1
This commit is contained in:
commit
709cc9bb50
16
powerline_shell/segments/k8s.py
Normal file
16
powerline_shell/segments/k8s.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
from ..utils import BasicSegment
|
||||
import subprocess
|
||||
|
||||
class Segment(BasicSegment):
|
||||
def add_to_powerline(self):
|
||||
try:
|
||||
kube_env = subprocess.check_output(['kubectl', 'config', 'current-context'], stderr=subprocess.STDOUT)
|
||||
if 'not set' in kube_env:
|
||||
raise Exception('k8s: Not set')
|
||||
except:
|
||||
kube_env = None
|
||||
|
||||
if kube_env:
|
||||
self.powerline.append(" %s " % str.strip(kube_env),
|
||||
self.powerline.theme.KUBECONFIG_PATH_FG,
|
||||
self.powerline.theme.KUBECONFIG_PATH_BG)
|
||||
|
|
@ -72,6 +72,9 @@ class DefaultColor(object):
|
|||
AWS_PROFILE_FG = 39
|
||||
AWS_PROFILE_BG = 238
|
||||
|
||||
KUBECONFIG_PATH_FG = 39
|
||||
KUBECONFIG_PATH_BG = 238
|
||||
|
||||
TIME_FG = 250
|
||||
TIME_BG = 238
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue