Support multiple 'default' contexts for Docker (#283)

* Support multiple 'default' contexts for Docker

If someone is using 'colima' instead of Docker Desktop, the default
context is 'colima'. Rather than making two tests with fixed values,
add a new configuration variable and use `contains`.

* Remove non-colour configuration from color files
This commit is contained in:
Austin Ziegler 2022-04-23 18:47:05 -04:00 committed by GitHub
parent 11ac7bacfe
commit 26f1a8d572
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 1 deletions

View File

@ -1,4 +1,5 @@
function _tide_item_docker
docker context inspect --format '{{.Name}}' | read -l context
test "$context" != default && _tide_print_item docker $tide_docker_icon' ' $context
contains -- "$context" $tide_docker_default_contexts ||
_tide_print_item docker $tide_docker_icon' ' $context
end

View File

@ -20,6 +20,7 @@ tide_context_color_ssh D7AF87
tide_docker_bg_color 444444
tide_docker_color 2496ED
tide_docker_icon
tide_docker_default_contexts default colima
tide_git_bg_color 444444
tide_git_bg_color_unstable 444444
tide_git_bg_color_urgent 444444

View File

@ -19,6 +19,7 @@ tide_context_color_root $_tide_color_gold
tide_context_color_ssh D7AF87
tide_docker_bg_color normal
tide_docker_color 2496ED
tide_docker_default_contexts default colima
tide_docker_icon
tide_git_bg_color normal
tide_git_bg_color_unstable normal

View File

@ -19,6 +19,7 @@ tide_context_color_root $_tide_color_gold
tide_context_color_ssh D7AF87
tide_docker_bg_color 2496ED
tide_docker_color 000000
tide_docker_default_contexts default colima
tide_docker_icon
tide_git_bg_color 4E9A06
tide_git_bg_color_unstable C4A000

View File

@ -9,5 +9,12 @@ set -lx tide_docker_icon 
mock docker "context inspect" "printf default"
_docker # CHECK:
mock docker "context inspect" "printf colima"
_docker # CHECK:
mock docker "context inspect" "printf curr-context"
_docker # CHECK:  curr-context
mock docker "context inspect" "printf curr-context"
set -lx tide_docker_default_contexts curr-context
_docker # CHECK: