Skip to content
This repository was archived by the owner on Sep 9, 2023. It is now read-only.

Commit 2af3285

Browse files
author
Ustun Ozgur
committed
add ability to toggle prompt by "kube_ps" without flags
Without any arguments, it toggles the env var and handles the initial invocation.
1 parent bbb2c4b commit 2af3285

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ function fish_prompt
2323
end
2424
```
2525

26+
Finally, enable the prompt by executing this once (the setting will be preserved
27+
across restarts of the shell.)
28+
29+
```fish
30+
kube_fs
31+
```
32+
2633
## Speed
2734

2835
Running the `kubectl` commands to get the context and namespace every time
@@ -38,6 +45,11 @@ This was not my idea, I took it from `jonmosco/kube-ps1`.
3845

3946
You can toggle the prompt on or off like this:
4047

48+
```fish
49+
kube_ps
50+
```
51+
52+
You can enable or disable the prompt like this:
4153
```fish
4254
kube_ps on
4355
kube_ps off

functions/kube_ps.fish

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,12 @@ function kube_ps -a toggle
88
set -U __kube_ps_enabled 0
99
return
1010
end
11+
12+
if test "$__kube_ps_enabled" = 1
13+
set -U __kube_ps_enabled 0
14+
return
15+
end
16+
17+
set -U __kube_ps_enabled 1
18+
1119
end

0 commit comments

Comments
 (0)