Skip to content
This repository was archived by the owner on Feb 3, 2021. It is now read-only.

Commit 85f9ef5

Browse files
authored
fix: correct incorrectly named config options (#198)
* fix: correct incorrectly named config options * fix: documentation for hostname options * fix: use mock to make kubectl test better reflect usage
1 parent 14346b2 commit 85f9ef5

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

docs/Options.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,16 @@ Directory is always shown and truncated to the value of `SPACEFISH_DIR_TRUNC`. W
8181
| `SPACEFISH_DIR_PREFIX` | `in·` | Prefix before current directory |
8282
| `SPACEFISH_DIR_LOCK_SHOW` | `true` | Show directory write-protected symbol |
8383
| `SPACEFISH_DIR_LOCK_SYMBOL` | ![·🔒](https://user-images.githubusercontent.com/11844760/47611530-7bf99c00-da8d-11e8-95da-f4ec1f23203a.png) | The symbol displayed if directory is write-protected (requires powerline patched font) |
84-
| `SPACESHIP_DIR_LOCK_COLOR` | `red` | Color for the lock symbol |
84+
| `SPACEFISH_DIR_LOCK_COLOR` | `red` | Color for the lock symbol |
8585

8686
### Hostname \(`host`\)
8787

8888
Hostname should only be shown while you are connected to another machine using SSH, unless you change it using SPACEFISH_HOST_SHOW.
8989

9090
| Variable | Default | Meaning |
9191
| :--- | :---: | --- |
92-
| `SPACEFISH_HOST_SHOW` | `true` | Show host section (true/false) |
93-
| `SPACEFISH_HOST_SHOW_FULL` | `false` | Show full hostname section (true/false) |
92+
| `SPACEFISH_HOST_SHOW` | `true` | Show host section (`true`, `false`, `always`) |
93+
| `SPACEFISH_HOST_SHOW_FULL` | `false` | Show full hostname section (`true`, `false`) |
9494
| `SPACEFISH_HOST_PREFIX` | `at·` | Prefix before the hostname |
9595
| `SPACEFISH_HOST_SUFFIX` | `$SPACEFISH_PROMPT_DEFAULT_SUFFIX` | Suffix after the hostname |
9696
| `SPACEFISH_HOST_COLOR` | `blue` | Color of the hostname |
@@ -266,7 +266,7 @@ Elixir section is shown when ```mix.exs``` is found or elixir files are found an
266266

267267
| Variable | Default | Meaning |
268268
| :------- | :-----: | ------- |
269-
| `SPACESHIP_ELIXIR_SHOW` | `true` | Show current Elixir version |
269+
| `SPACEFISH_ELIXIR_SHOW` | `true` | Show current Elixir version |
270270
| `SPACEFISH_ELIXIR_PREFIX` | `$SPACEFISH_PROMPT_DEFAULT_PREFIX` | Prefix before the elixir section |
271271
| `SPACEFISH_ELIXIR_SUFFIX` | `$SPACEFISH_PROMPT_DEFAULT_SUFFIX` | Suffix after the elixir section |
272272
| `SPACEFISH_ELIXIR_SYMBOL` | `💧·` | Character to be shown before Elixir version |
@@ -341,7 +341,7 @@ Kubernetes context is shown everywhere if `kubectl` binary is found.
341341
| Variable | Default | Meaning |
342342
| :------- | :-----: | ------- |
343343
| `SPACEFISH_KUBECONTEXT_SHOW` | `true` | Show current kubectl context |
344-
| `SPACESHIP_KUBECONTEXT_NAMESPACE_SHOW` | `true` | Show current kubectl context namespace|
344+
| `SPACEFISH_KUBECONTEXT_NAMESPACE_SHOW` | `true` | Show current kubectl context namespace|
345345
| `SPACEFISH_KUBECONTEXT_PREFIX` | `at ` | Prefix before the kubectl section |
346346
| `SPACEFISH_KUBECONTEXT_SUFFIX` | `$SPACEFISH_PROMPT_DEFAULT_SUFFIX` | Suffix after the kubectl section |
347347
| `SPACEFISH_KUBECONTEXT_SYMBOL` | `☸️ ` | Character to be shown before kubectl context |

functions/__sf_section_kubecontext.fish

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function __sf_section_kubecontext -d "Display the kubernetes context"
1111
# ------------------------------------------------------------------------------
1212

1313
__sf_util_set_default SPACEFISH_KUBECONTEXT_SHOW true
14-
__sf_util_set_default SPACESHIP_KUBECONTEXT_NAMESPACE_SHOW true
14+
__sf_util_set_default SPACEFISH_KUBECONTEXT_NAMESPACE_SHOW true
1515
__sf_util_set_default SPACEFISH_KUBECONTEXT_PREFIX "at "
1616
__sf_util_set_default SPACEFISH_KUBECONTEXT_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
1717
# Additional space is added because ☸️ is wider than other symbols
@@ -31,8 +31,8 @@ function __sf_section_kubecontext -d "Display the kubernetes context"
3131

3232
set -l kube_context (kubectl config current-context 2>/dev/null)
3333
[ -z $kube_context ]; and return
34-
35-
if test "$SPACESHIP_KUBECONTEXT_NAMESPACE_SHOW" = "true" -a "$kube_context" != "default"
34+
35+
if test "$SPACEFISH_KUBECONTEXT_NAMESPACE_SHOW" = "true" -a "$kube_context" != "default"
3636
set kube_namespace (kubectl config view --minify --output 'jsonpath={..namespace}' 2>/dev/null)
3737
set kube_context "$kube_context ($kube_namespace)"
3838
end

tests/__sf_section_kubecontext.test.fish

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ test "Doesn't display the section when SPACEFISH_KUBECONTEXT_SHOW is set to \"fa
8181
) = (__sf_section_kubecontext)
8282
end
8383

84-
test "Doesn't display the namespace section when SPACESHIP_KUBECONTEXT_NAMESPACE_SHOW is set to \"false\""
84+
test "Doesn't display the namespace section when SPACEFISH_KUBECONTEXT_NAMESPACE_SHOW is set to \"false\""
8585
(
86-
set SPACESHIP_KUBECONTEXT_NAMESPACE_SHOW false
86+
set SPACEFISH_KUBECONTEXT_NAMESPACE_SHOW false
8787
set sf_exit_code 0
8888
set SPACEFISH_KUBECONTEXT_SUFFIX ·
8989

@@ -99,16 +99,18 @@ test "Doesn't display the namespace section when SPACESHIP_KUBECONTEXT_NAMESPACE
9999
) = (__sf_section_kubecontext)
100100
end
101101

102-
test "Doesn't display the namespace section when kube_context is set to \"false\""
102+
test "Doesn't display the namespace section when kube_context is set to \"default\""
103103
(
104+
mock kubectl config 0 "echo \"default\""
105+
104106
set sf_exit_code 0
105107
set SPACEFISH_KUBECONTEXT_SUFFIX ·
106-
set kube_context "default"
108+
107109
set_color --bold
108110
echo -n "at "
109111
set_color normal
110112
set_color --bold cyan
111-
echo -n "☸️ testkube"
113+
echo -n "☸️ default"
112114
set_color normal
113115
set_color --bold
114116
echo -n "·"

0 commit comments

Comments
 (0)