Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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/

6 changes: 3 additions & 3 deletions powerline_shell/colortrans.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,19 @@ def rgbstring2tuple(s):
(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,
Expand Down
16 changes: 16 additions & 0 deletions powerline_shell/segments/kube_context.py
Original file line number Diff line number Diff line change
@@ -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)

4 changes: 4 additions & 0 deletions powerline_shell/themes/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@ class Color(DefaultColor):

TIME_FG = 8
TIME_BG = 7

KUBE_CONTEXT_FG = 14
KUBE_CONTEXT_BG = 8

3 changes: 3 additions & 0 deletions powerline_shell/themes/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ class DefaultColor(object):
TIME_FG = 250
TIME_BG = 238

KUBE_CONTEXT_FG = 38
KUBE_CONTEXT_BG = 239


class Color(DefaultColor):
"""
Expand Down
4 changes: 4 additions & 0 deletions powerline_shell/themes/gruvbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,7 @@ class Color(DefaultColor):

TIME_FG = light2
TIME_BG = dark4

KUBE_CONTEXT_FG = neutral_blue
KUBE_CONTEXT_BG = dark2

4 changes: 4 additions & 0 deletions powerline_shell/themes/solarized_dark.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@ class Color(DefaultColor):

TIME_FG = 15
TIME_BG = 10

KUBE_CONTEXT_FG = 7
KUBE_CONTEXT_BG = 2

3 changes: 3 additions & 0 deletions powerline_shell/themes/washed.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ class Color(DefaultColor):

TIME_FG = 8
TIME_BG = 7

KUBE_CONTEXT_FG = 0
KUBE_CONTEXT_BG = 7