Skip to content

Commit

Permalink
[segment] added kubecontext segment
Browse files Browse the repository at this point in the history
[segment] added kubecontext segement

[segment] added kubecontext segement

[segment] added kubecontext segement
  • Loading branch information
sandjaie committed Aug 1, 2020
1 parent 03c8c64 commit 5a54246
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 104 deletions.
90 changes: 4 additions & 86 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ tags
config.json
powerline-shell.json
.DS_Store

# editors
*sublime*
.vscode/
.idea/

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down Expand Up @@ -38,16 +42,6 @@ share/python-wheels/
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
Expand All @@ -63,59 +57,6 @@ coverage.xml
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
Expand All @@ -125,26 +66,3 @@ ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/
2 changes: 1 addition & 1 deletion powerline_shell/colortrans.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@

class Segment(BasicSegment):
def add_to_powerline(self):
kubecontext = os.environ.get("KUBECONFIG")
if kubecontext:
self.powerline.append(" kctx:%s " % os.path.basename(kubecontext),
self.powerline.theme.KUBECONFIG_FG,
self.powerline.theme.KUBECONFIG_BG)
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)

5 changes: 3 additions & 2 deletions powerline_shell/themes/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@ class Color(DefaultColor):
TIME_FG = 8
TIME_BG = 7

KUBECONFIG_FG = 14
KUBECONFIG_BG = 8
KUBE_CONTEXT_FG = 14
KUBE_CONTEXT_BG = 8

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

KUBECONFIG_FG = 38
KUBECONFIG_BG = 239
KUBE_CONTEXT_FG = 38
KUBE_CONTEXT_BG = 239


class Color(DefaultColor):
"""
Expand Down
5 changes: 3 additions & 2 deletions powerline_shell/themes/gruvbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,6 @@ class Color(DefaultColor):
TIME_FG = light2
TIME_BG = dark4

KUBECONFIG_BG = neutral_blue
KUBECONFIG_FG = dark2
KUBE_CONTEXT_FG = neutral_blue
KUBE_CONTEXT_BG = dark2

5 changes: 3 additions & 2 deletions powerline_shell/themes/solarized_dark.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@ class Color(DefaultColor):
TIME_FG = 15
TIME_BG = 10

KUBECONFIG_FG = 7
KUBECONFIG_BG = 2
KUBE_CONTEXT_FG = 7
KUBE_CONTEXT_BG = 2

4 changes: 2 additions & 2 deletions powerline_shell/themes/washed.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ class Color(DefaultColor):
TIME_FG = 8
TIME_BG = 7

KUBECONFIG_FG = 0
KUBECONFIG_BG = 7
KUBE_CONTEXT_FG = 0
KUBE_CONTEXT_BG = 7
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from setuptools import setup, find_packages

setup(
name="powerline-shell-test",
name="powerline-shell",
version="0.7.0",
description="A pretty prompt for your shell",
author="Buck Ryan",
Expand All @@ -27,6 +27,6 @@
],
entry_points="""
[console_scripts]
powerline-shell-test=powerline_shell:main
powerline-shell=powerline_shell:main
""",
)

0 comments on commit 5a54246

Please sign in to comment.