Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docker context item #231

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions functions/_tide_item_docker.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function _tide_item_docker
docker context inspect --format '{{.Name}}' | read -l context
test "$context" != default && _tide_print_item docker $tide_docker_icon' ' $context
end
2 changes: 1 addition & 1 deletion functions/_tide_remove_unusable_items.fish
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function _tide_remove_unusable_items
# Remove tool-specific items for tools the machine doesn't have installed
for item in chruby git go kubectl node php rustc terraform virtual_env
for item in chruby git go kubectl node php rustc terraform virtual_env docker
set -l cli_names $item
switch $item
case virtual_env
Expand Down
3 changes: 3 additions & 0 deletions functions/tide/configure/configs/classic.fish
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ tide_jobs_icon ''
tide_kubectl_bg_color 444444
tide_kubectl_color 326CE5
tide_kubectl_icon '⎈'
tide_docker_bg_color 444444
tide_docker_color 2496ED
tide_docker_icon ''
tide_left_prompt_frame_enabled true
tide_left_prompt_items pwd git newline
tide_left_prompt_prefix ''
Expand Down
2 changes: 2 additions & 0 deletions functions/tide/configure/configs/classic_16color.fish
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ tide_jobs_bg_color black
tide_jobs_color green
tide_kubectl_bg_color black
tide_kubectl_color blue
tide_docker_bg_color black
tide_docker_color blue
tide_node_bg_color black
tide_node_color green
tide_os_bg_color black
Expand Down
3 changes: 3 additions & 0 deletions functions/tide/configure/configs/lean.fish
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ tide_jobs_icon ''
tide_kubectl_bg_color normal
tide_kubectl_color 326CE5
tide_kubectl_icon '⎈'
tide_docker_bg_color normal
tide_docker_color 2496ED
tide_docker_icon ''
tide_left_prompt_frame_enabled false
tide_left_prompt_items pwd git newline character
tide_left_prompt_prefix ''
Expand Down
2 changes: 2 additions & 0 deletions functions/tide/configure/configs/lean_16color.fish
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ tide_jobs_bg_color normal
tide_jobs_color green
tide_kubectl_bg_color normal
tide_kubectl_color blue
tide_docker_bg_color normal
tide_docker_color blue
tide_node_bg_color normal
tide_node_color green
tide_os_bg_color normal
Expand Down
3 changes: 3 additions & 0 deletions functions/tide/configure/configs/rainbow.fish
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ tide_jobs_icon ''
tide_kubectl_bg_color 326CE5
tide_kubectl_color 000000
tide_kubectl_icon '⎈'
tide_docker_bg_color 2496ED
tide_docker_color 000000
tide_docker_icon ''
tide_left_prompt_frame_enabled true
tide_left_prompt_items pwd git newline
tide_left_prompt_prefix ''
Expand Down
2 changes: 2 additions & 0 deletions functions/tide/configure/configs/rainbow_16color.fish
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ tide_jobs_bg_color brblack
tide_jobs_color green
tide_kubectl_bg_color blue
tide_kubectl_color black
tide_docker_bg_color blue
tide_docker_color black
tide_node_bg_color green
tide_node_color black
tide_os_bg_color white
Expand Down
13 changes: 13 additions & 0 deletions tests/_tide_item_docker.test.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# RUN: %fish %s

function _docker
_tide_decolor (_tide_item_docker)
end

set -lx tide_docker_icon 

mock docker "context inspect" "printf default"
_docker # CHECK:

mock docker "context inspect" "printf curr-context"
_docker # CHECK:  curr-context