This commit is contained in:
Sandjaie Ravi 2022-09-22 14:16:32 -04:00 committed by GitHub
commit 711119a154
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 94 additions and 3 deletions

57
.gitignore vendored
View file

@ -8,4 +8,61 @@ tags
config.json
powerline-shell.json
.DS_Store
# editors
*sublime*
.vscode/
.idea/
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

View file

@ -100,19 +100,19 @@ RGB2SHORT_DICT = {
(95, 135, 215): 68,
(95, 135, 255): 69,
(95, 175, 0): 70,
(95, 175, 95) : 71,
(95, 175, 95): 71,
(95, 175, 135): 72,
(95, 175, 175): 73,
(95, 175, 215): 74,
(95, 175, 255): 75,
(95, 215, 0): 76,
(95, 215, 95) : 77,
(95, 215, 95): 77,
(95, 215, 135): 78,
(95, 215, 175): 79,
(95, 215, 215): 80,
(95, 215, 255): 81,
(95, 255, 0): 82,
(95, 255, 95) : 83,
(95, 255, 95): 83,
(95, 255, 135): 84,
(95, 255, 175): 85,
(95, 255, 215): 86,

View file

@ -0,0 +1,16 @@
"""
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 kube_context:
self.powerline.append(" kctx:%s " % os.path.basename(kube_context),
self.powerline.theme.KUBE_CONTEXT_FG,
self.powerline.theme.KUBE_CONTEXT_BG)

View file

@ -43,3 +43,7 @@ class Color(DefaultColor):
TIME_FG = 8
TIME_BG = 7
KUBE_CONTEXT_FG = 14
KUBE_CONTEXT_BG = 8

View file

@ -75,6 +75,9 @@ class DefaultColor(object):
TIME_FG = 250
TIME_BG = 238
KUBE_CONTEXT_FG = 38
KUBE_CONTEXT_BG = 239
class Color(DefaultColor):
"""

View file

@ -109,3 +109,7 @@ class Color(DefaultColor):
TIME_FG = light2
TIME_BG = dark4
KUBE_CONTEXT_FG = neutral_blue
KUBE_CONTEXT_BG = dark2

View file

@ -42,3 +42,7 @@ class Color(DefaultColor):
TIME_FG = 15
TIME_BG = 10
KUBE_CONTEXT_FG = 7
KUBE_CONTEXT_BG = 2

View file

@ -42,3 +42,6 @@ class Color(DefaultColor):
TIME_FG = 8
TIME_BG = 7
KUBE_CONTEXT_FG = 0
KUBE_CONTEXT_BG = 7