2daffdf101f21575f7904d92b29c16bcb448aa10
- Author
- ohmyzsh[bot] <54982679+ohmyzsh[bot]@users.noreply.github.com>
- Committer
- GitHub <noreply@github.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/.github/dependencies.yml b/.github/dependencies.yml
2index 048cc0f7fa425a5115adcda4abb16642a779536c..270cb9ec6e1cea9d645658564bea35d4efdadab1 100644
3--- a/.github/dependencies.yml
4+++ b/.github/dependencies.yml
5@@ -30,7 +30,7 @@ dependencies:
6 plugins/kube-ps1:
7 repo: jonmosco/kube-ps1
8 branch: master
9- version: e1da055e905a91242f0c5a89a425a64ee8adcd6b
10+ version: 0b0e6daf4197ecabb1ae4f2d46fb148a8e1e73e5
11 precopy: |
12 set -e
13 find . ! -name kube-ps1.sh ! -name LICENSE ! -name README.md -delete
14diff --git a/plugins/kube-ps1/LICENSE b/plugins/kube-ps1/LICENSE
15new file mode 100644
16index 0000000000000000000000000000000000000000..261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64
17--- /dev/null
18+++ b/plugins/kube-ps1/LICENSE
19@@ -0,0 +1,201 @@
20+ Apache License
21+ Version 2.0, January 2004
22+ http://www.apache.org/licenses/
23+
24+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
25+
26+ 1. Definitions.
27+
28+ "License" shall mean the terms and conditions for use, reproduction,
29+ and distribution as defined by Sections 1 through 9 of this document.
30+
31+ "Licensor" shall mean the copyright owner or entity authorized by
32+ the copyright owner that is granting the License.
33+
34+ "Legal Entity" shall mean the union of the acting entity and all
35+ other entities that control, are controlled by, or are under common
36+ control with that entity. For the purposes of this definition,
37+ "control" means (i) the power, direct or indirect, to cause the
38+ direction or management of such entity, whether by contract or
39+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
40+ outstanding shares, or (iii) beneficial ownership of such entity.
41+
42+ "You" (or "Your") shall mean an individual or Legal Entity
43+ exercising permissions granted by this License.
44+
45+ "Source" form shall mean the preferred form for making modifications,
46+ including but not limited to software source code, documentation
47+ source, and configuration files.
48+
49+ "Object" form shall mean any form resulting from mechanical
50+ transformation or translation of a Source form, including but
51+ not limited to compiled object code, generated documentation,
52+ and conversions to other media types.
53+
54+ "Work" shall mean the work of authorship, whether in Source or
55+ Object form, made available under the License, as indicated by a
56+ copyright notice that is included in or attached to the work
57+ (an example is provided in the Appendix below).
58+
59+ "Derivative Works" shall mean any work, whether in Source or Object
60+ form, that is based on (or derived from) the Work and for which the
61+ editorial revisions, annotations, elaborations, or other modifications
62+ represent, as a whole, an original work of authorship. For the purposes
63+ of this License, Derivative Works shall not include works that remain
64+ separable from, or merely link (or bind by name) to the interfaces of,
65+ the Work and Derivative Works thereof.
66+
67+ "Contribution" shall mean any work of authorship, including
68+ the original version of the Work and any modifications or additions
69+ to that Work or Derivative Works thereof, that is intentionally
70+ submitted to Licensor for inclusion in the Work by the copyright owner
71+ or by an individual or Legal Entity authorized to submit on behalf of
72+ the copyright owner. For the purposes of this definition, "submitted"
73+ means any form of electronic, verbal, or written communication sent
74+ to the Licensor or its representatives, including but not limited to
75+ communication on electronic mailing lists, source code control systems,
76+ and issue tracking systems that are managed by, or on behalf of, the
77+ Licensor for the purpose of discussing and improving the Work, but
78+ excluding communication that is conspicuously marked or otherwise
79+ designated in writing by the copyright owner as "Not a Contribution."
80+
81+ "Contributor" shall mean Licensor and any individual or Legal Entity
82+ on behalf of whom a Contribution has been received by Licensor and
83+ subsequently incorporated within the Work.
84+
85+ 2. Grant of Copyright License. Subject to the terms and conditions of
86+ this License, each Contributor hereby grants to You a perpetual,
87+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
88+ copyright license to reproduce, prepare Derivative Works of,
89+ publicly display, publicly perform, sublicense, and distribute the
90+ Work and such Derivative Works in Source or Object form.
91+
92+ 3. Grant of Patent License. Subject to the terms and conditions of
93+ this License, each Contributor hereby grants to You a perpetual,
94+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
95+ (except as stated in this section) patent license to make, have made,
96+ use, offer to sell, sell, import, and otherwise transfer the Work,
97+ where such license applies only to those patent claims licensable
98+ by such Contributor that are necessarily infringed by their
99+ Contribution(s) alone or by combination of their Contribution(s)
100+ with the Work to which such Contribution(s) was submitted. If You
101+ institute patent litigation against any entity (including a
102+ cross-claim or counterclaim in a lawsuit) alleging that the Work
103+ or a Contribution incorporated within the Work constitutes direct
104+ or contributory patent infringement, then any patent licenses
105+ granted to You under this License for that Work shall terminate
106+ as of the date such litigation is filed.
107+
108+ 4. Redistribution. You may reproduce and distribute copies of the
109+ Work or Derivative Works thereof in any medium, with or without
110+ modifications, and in Source or Object form, provided that You
111+ meet the following conditions:
112+
113+ (a) You must give any other recipients of the Work or
114+ Derivative Works a copy of this License; and
115+
116+ (b) You must cause any modified files to carry prominent notices
117+ stating that You changed the files; and
118+
119diff --git a/plugins/kube-ps1/README.md b/plugins/kube-ps1/README.md
120index be3c184be41a44e36f98b2c0e9afec210aeaf4e5..ef6d781ad07e478cf6e9bd2a9257f4e2b1d176ef 100644
121--- a/plugins/kube-ps1/README.md
122+++ b/plugins/kube-ps1/README.md
123@@ -1,49 +1,82 @@
124 # kube-ps1: Kubernetes prompt for bash and zsh
125
126+
127+[](https://github.com/jonmosco/kube-ps1/actions/workflows/ci.yml)
128+
129 A script that lets you add the current Kubernetes context and namespace
130 configured on `kubectl` to your Bash/Zsh prompt strings (i.e. the `$PS1`).
131
132 Inspired by several tools used to simplify usage of `kubectl`.
133
134+
135+
136 ## Installing
137
138-### MacOS
139+### Packages
140+
141+### MacOS Brew Ports
142
143 Homebrew package manager:
144
145+```sh
146+brew update
147+brew install kube-ps1
148+```
149+
150+### Arch Linux
151+
152+AUR Package available at [https://aur.archlinux.org/packages/kube-ps1/](https://aur.archlinux.org/packages/kube-ps1/).
153+
154+### Oh My Zsh
155+
156+https://github.com/ohmyzsh/ohmyzsh
157+
158+kube-ps1 is included as a plugin in the oh-my-zsh project. To enable it, edit your `~/.zshrc` and
159+add the plugin:
160+
161+```bash
162+plugins=(
163+ kube-ps1
164+)
165+PROMPT='$(kube_ps1)'$PROMPT # or RPROMPT='$(kube_ps1)'
166 ```
167-$ brew update
168-$ brew install kube-ps1
169+
170+## Zsh zinit plugin
171+
172+### Using [zinit](https://github.com/zdharma-continuum/zinit)
173+
174+Update `.zshrc` with:
175+
176+```sh
177+zinit light jonmosco/kube-ps1
178+PROMPT='$(kube_ps1)'$PROMPT # or RPROMPT='$(kube_ps1)'
179 ```
180-### From Source
181+
182+### Fig
183+
184+Install `kube-ps1` in zsh, bash, or fish with one click.
185+
186+<a href="https://fig.io/plugins/other/kube-ps1" target="_blank"><img src="https://fig.io/badges/install-with-fig.svg" width="120" /></a>
187+
188+### From Source (git clone)
189
190 1. Clone this repository
191 2. Source the kube-ps1.sh in your `~/.zshrc` or your `~/.bashrc`
192
193-### Arch Linux
194-AUR Package available at [https://aur.archlinux.org/packages/kube-ps1/](https://aur.archlinux.org/packages/kube-ps1/).
195-
196 #### Zsh
197+
198 ```sh
199 source /path/to/kube-ps1.sh
200-PROMPT='$(kube_ps1)'$PROMPT
201+PROMPT='$(kube_ps1)'$PROMPT # or RPROMPT='$(kube_ps1)'
202 ```
203+
204 #### Bash
205+
206 ```sh
207 source /path/to/kube-ps1.sh
208 PS1='[\u@\h \W $(kube_ps1)]\$ '
209 ```
210
211-### Zsh Plugin Managers
212-
213-#### Using [zplugin](https://github.com/zdharma/zplugin)
214-
215-Update `.zshrc` with:
216-```sh
217-zplugin light jonmosco/kube-ps1
218-PROMPT='$(kube_ps1)'$PROMPT
219-```
220-
221 ## Requirements
222
223diff --git a/plugins/kube-ps1/kube-ps1.plugin.zsh b/plugins/kube-ps1/kube-ps1.plugin.zsh
224index 7edc62de8c91e0461f83f473eac74b3436c2b07c..95e91e0d320469e6b95af1770d1efa418b69c86f 100644
225--- a/plugins/kube-ps1/kube-ps1.plugin.zsh
226+++ b/plugins/kube-ps1/kube-ps1.plugin.zsh
227@@ -3,7 +3,7 @@
228 # Kubernetes prompt helper for bash/zsh
229 # Displays current context and namespace
230
231-# Copyright 2021 Jon Mosco
232+# Copyright 2026 Jon Mosco
233 #
234 # Licensed under the Apache License, Version 2.0 (the "License");
235 # you may not use this file except in compliance with the License.
236@@ -24,9 +24,9 @@
237 # Override these values in ~/.zshrc or ~/.bashrc
238 KUBE_PS1_BINARY="${KUBE_PS1_BINARY:-kubectl}"
239 KUBE_PS1_SYMBOL_ENABLE="${KUBE_PS1_SYMBOL_ENABLE:-true}"
240-KUBE_PS1_SYMBOL_DEFAULT=${KUBE_PS1_SYMBOL_DEFAULT:-$'\u2388'}
241 KUBE_PS1_SYMBOL_PADDING="${KUBE_PS1_SYMBOL_PADDING:-false}"
242-KUBE_PS1_SYMBOL_USE_IMG="${KUBE_PS1_SYMBOL_USE_IMG:-false}"
243+KUBE_PS1_SYMBOL_COLOR="${KUBE_PS1_SYMBOL_COLOR:-}"
244+
245 KUBE_PS1_NS_ENABLE="${KUBE_PS1_NS_ENABLE:-true}"
246 KUBE_PS1_CONTEXT_ENABLE="${KUBE_PS1_CONTEXT_ENABLE:-true}"
247 KUBE_PS1_PREFIX="${KUBE_PS1_PREFIX-(}"
248@@ -34,29 +34,28 @@ KUBE_PS1_SEPARATOR="${KUBE_PS1_SEPARATOR-|}"
249 KUBE_PS1_DIVIDER="${KUBE_PS1_DIVIDER-:}"
250 KUBE_PS1_SUFFIX="${KUBE_PS1_SUFFIX-)}"
251
252-KUBE_PS1_SYMBOL_COLOR="${KUBE_PS1_SYMBOL_COLOR-blue}"
253-KUBE_PS1_CTX_COLOR="${KUBE_PS1_CTX_COLOR-red}"
254-KUBE_PS1_NS_COLOR="${KUBE_PS1_NS_COLOR-cyan}"
255-KUBE_PS1_BG_COLOR="${KUBE_PS1_BG_COLOR}"
256+KUBE_PS1_HIDE_IF_NOCONTEXT="${KUBE_PS1_HIDE_IF_NOCONTEXT:-false}"
257
258-KUBE_PS1_KUBECONFIG_CACHE="${KUBECONFIG}"
259-KUBE_PS1_KUBECONFIG_SYMLINK="${KUBE_PS1_KUBECONFIG_SYMLINK:-false}"
260-KUBE_PS1_DISABLE_PATH="${HOME}/.kube/kube-ps1/disabled"
261-KUBE_PS1_LAST_TIME=0
262-KUBE_PS1_CLUSTER_FUNCTION="${KUBE_PS1_CLUSTER_FUNCTION}"
263-KUBE_PS1_NAMESPACE_FUNCTION="${KUBE_PS1_NAMESPACE_FUNCTION}"
264+_KUBE_PS1_KUBECONFIG_CACHE="${KUBECONFIG}"
265+_KUBE_PS1_DISABLE_PATH="${HOME}/.kube/kube-ps1/disabled"
266+_KUBE_PS1_LAST_TIME=0
267
268 # Determine our shell
269-if [ "${ZSH_VERSION-}" ]; then
270- KUBE_PS1_SHELL="zsh"
271-elif [ "${BASH_VERSION-}" ]; then
272- KUBE_PS1_SHELL="bash"
273-fi
274+_kube_ps1_shell_type() {
275+ local _KUBE_PS1_SHELL_TYPE
276+
277+ if [ "${ZSH_VERSION-}" ]; then
278+ _KUBE_PS1_SHELL_TYPE="zsh"
279+ elif [ "${BASH_VERSION-}" ]; then
280+ _KUBE_PS1_SHELL_TYPE="bash"
281+ fi
282+ echo $_KUBE_PS1_SHELL_TYPE
283+}
284
285 _kube_ps1_init() {
286- [[ -f "${KUBE_PS1_DISABLE_PATH}" ]] && KUBE_PS1_ENABLED=off
287+ [[ -f "${_KUBE_PS1_DISABLE_PATH}" ]] && KUBE_PS1_ENABLED=off
288
289- case "${KUBE_PS1_SHELL}" in
290+ case "$(_kube_ps1_shell_type)" in
291 "zsh")
292 _KUBE_PS1_OPEN_ESC="%{"
293 _KUBE_PS1_CLOSE_ESC="%}"
294@@ -64,7 +63,7 @@ _kube_ps1_init() {
295 _KUBE_PS1_DEFAULT_FG="%f"
296 setopt PROMPT_SUBST
297 autoload -U add-zsh-hook
298- add-zsh-hook precmd _kube_ps1_update_cache
299+ add-zsh-hook precmd _kube_ps1_prompt_update
300 zmodload -F zsh/stat b:zstat
301 zmodload zsh/datetime
302 ;;
303@@ -73,75 +72,75 @@ _kube_ps1_init() {
304 _KUBE_PS1_CLOSE_ESC=$'\002'
305 _KUBE_PS1_DEFAULT_BG=$'\033[49m'
306 _KUBE_PS1_DEFAULT_FG=$'\033[39m'
307- [[ $PROMPT_COMMAND =~ _kube_ps1_update_cache ]] || PROMPT_COMMAND="_kube_ps1_update_cache;${PROMPT_COMMAND:-:}"
308+ [[ $PROMPT_COMMAND =~ _kube_ps1_prompt_update ]] || PROMPT_COMMAND="_kube_ps1_prompt_update;${PROMPT_COMMAND:-:}"
309 ;;
310 esac
311 }
312
313 _kube_ps1_color_fg() {
314- local KUBE_PS1_FG_CODE
315+ local _KUBE_PS1_FG_CODE
316 case "${1}" in
317- black) KUBE_PS1_FG_CODE=0;;
318- red) KUBE_PS1_FG_CODE=1;;
319- green) KUBE_PS1_FG_CODE=2;;
320- yellow) KUBE_PS1_FG_CODE=3;;
321- blue) KUBE_PS1_FG_CODE=4;;
322- magenta) KUBE_PS1_FG_CODE=5;;
323- cyan) KUBE_PS1_FG_CODE=6;;
324- white) KUBE_PS1_FG_CODE=7;;
325+ black) _KUBE_PS1_FG_CODE=0;;
326+ red) _KUBE_PS1_FG_CODE=1;;