-
Notifications
You must be signed in to change notification settings - Fork 745
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[segment] added kubecontext segement
- Loading branch information
Showing
8 changed files
with
91 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
""" | ||
Shows the exported kubectl context | ||
e.g $ export KUBECONFIG=~/.kube/config-staging-cluster | ||
""" | ||
from ..utils import BasicSegment | ||
import os | ||
|
||
|
||
class Segment(BasicSegment): | ||
def add_to_powerline(self): | ||
kube_context = os.environ.get("KUBECONFIG") | ||
if kubecontext: | ||
self.powerline.append(" kctx:%s " % os.path.basename(kube_context), | ||
self.powerline.theme.KUBE_CONTEXT_FG, | ||
self.powerline.theme.KUBE_CONTEXT_BG) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,3 +43,6 @@ class Color(DefaultColor): | |
|
||
TIME_FG = 8 | ||
TIME_BG = 7 | ||
|
||
KUBE_CONTEXT_FG = 14 | ||
KUBE_CONTEXT_BG = 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,3 +42,6 @@ class Color(DefaultColor): | |
|
||
TIME_FG = 15 | ||
TIME_BG = 10 | ||
|
||
KUBE_CONTEXT_FG = 7 | ||
KUBE_CONTEXT_BG = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,3 +42,6 @@ class Color(DefaultColor): | |
|
||
TIME_FG = 8 | ||
TIME_BG = 7 | ||
|
||
KUBE_CONTEXT_FG = 0 | ||
KUBE_CONTEXT_BG = 7 |