mirror of
https://github.com/IlanCosman/tide.git
synced 2024-11-22 13:53:07 +03:00
Add Terraform item (#203)
* Add Terraform item * Do not show default workspace in Terraform prompt * Add terraform to tide_right_prompt_items * Add terraform to _tide_remove_unusable_items * Fix test, use read, format Co-authored-by: Ilan Cosman <ilancosman@gmail.com>
This commit is contained in:
parent
03bffd90c3
commit
3787c725f7
6
functions/_tide_item_terraform.fish
Normal file
6
functions/_tide_item_terraform.fish
Normal file
@ -0,0 +1,6 @@
|
||||
function _tide_item_terraform
|
||||
if test -d .terraform
|
||||
terraform workspace show | read -l workspace
|
||||
test $workspace != default && _tide_print_item terraform $tide_terraform_icon' ' $workspace
|
||||
end
|
||||
end
|
@ -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 virtual_env
|
||||
for item in chruby git go kubectl node php rustc terraform virtual_env
|
||||
set -l cli_names $item
|
||||
switch $item
|
||||
case virtual_env
|
||||
|
@ -67,7 +67,7 @@ tide_pwd_icon_home
|
||||
tide_pwd_icon_unwritable ''
|
||||
tide_pwd_markers .bzr .citc .git .hg .node-version .python-version .ruby-version .shorten_folder_marker .svn .terraform Cargo.toml composer.json CVS go.mod package.json
|
||||
tide_right_prompt_frame_enabled true
|
||||
tide_right_prompt_items status cmd_duration context jobs node virtual_env rustc php chruby go kubectl vi_mode
|
||||
tide_right_prompt_items status cmd_duration context jobs node virtual_env rustc php chruby go kubectl terraform vi_mode
|
||||
tide_right_prompt_prefix ''
|
||||
tide_right_prompt_separator_diff_color ''
|
||||
tide_right_prompt_separator_same_color ''
|
||||
@ -85,6 +85,9 @@ tide_status_color $_tide_color_dark_green
|
||||
tide_status_color_failure D70000
|
||||
tide_status_icon '✔'
|
||||
tide_status_icon_failure '✘'
|
||||
tide_terraform_bg_color 444444
|
||||
tide_terraform_color 844FBA
|
||||
tide_terraform_icon
|
||||
tide_time_bg_color 444444
|
||||
tide_time_color 5F8787
|
||||
tide_time_format '%T'
|
||||
|
@ -45,6 +45,8 @@ tide_status_bg_color black
|
||||
tide_status_bg_color_failure black
|
||||
tide_status_color green
|
||||
tide_status_color_failure red
|
||||
tide_terraform_bg_color black
|
||||
tide_terraform_color magenta
|
||||
tide_time_bg_color black
|
||||
tide_time_color brblack
|
||||
tide_vi_mode_bg_color_default black
|
||||
|
@ -67,7 +67,7 @@ tide_pwd_icon_home
|
||||
tide_pwd_icon_unwritable ''
|
||||
tide_pwd_markers .bzr .citc .git .hg .node-version .python-version .ruby-version .shorten_folder_marker .svn .terraform Cargo.toml composer.json CVS go.mod package.json
|
||||
tide_right_prompt_frame_enabled false
|
||||
tide_right_prompt_items status cmd_duration context jobs node virtual_env rustc php chruby go kubectl
|
||||
tide_right_prompt_items status cmd_duration context jobs node virtual_env rustc php chruby go kubectl terraform
|
||||
tide_right_prompt_prefix ' '
|
||||
tide_right_prompt_separator_diff_color ' '
|
||||
tide_right_prompt_separator_same_color ' '
|
||||
@ -85,6 +85,9 @@ tide_status_color $_tide_color_dark_green
|
||||
tide_status_color_failure D70000
|
||||
tide_status_icon '✔'
|
||||
tide_status_icon_failure '✘'
|
||||
tide_terraform_bg_color normal
|
||||
tide_terraform_color 844FBA
|
||||
tide_terraform_icon
|
||||
tide_time_bg_color normal
|
||||
tide_time_color 5F8787
|
||||
tide_time_format '%T'
|
||||
|
@ -45,6 +45,8 @@ tide_status_bg_color normal
|
||||
tide_status_bg_color_failure normal
|
||||
tide_status_color green
|
||||
tide_status_color_failure red
|
||||
tide_terraform_bg_color normal
|
||||
tide_terraform_color magenta
|
||||
tide_time_bg_color normal
|
||||
tide_time_color brblack
|
||||
tide_vi_mode_bg_color_default normal
|
||||
|
@ -67,7 +67,7 @@ tide_pwd_icon_home
|
||||
tide_pwd_icon_unwritable ''
|
||||
tide_pwd_markers .bzr .citc .git .hg .node-version .python-version .ruby-version .shorten_folder_marker .svn .terraform Cargo.toml composer.json CVS go.mod package.json
|
||||
tide_right_prompt_frame_enabled true
|
||||
tide_right_prompt_items status cmd_duration context jobs node virtual_env rustc php chruby go kubectl vi_mode
|
||||
tide_right_prompt_items status cmd_duration context jobs node virtual_env rustc php chruby go kubectl terraform vi_mode
|
||||
tide_right_prompt_prefix ''
|
||||
tide_right_prompt_separator_diff_color ''
|
||||
tide_right_prompt_separator_same_color ''
|
||||
@ -85,6 +85,9 @@ tide_status_color 4E9A06
|
||||
tide_status_color_failure FFFF00
|
||||
tide_status_icon '✔'
|
||||
tide_status_icon_failure '✘'
|
||||
tide_terraform_bg_color 800080
|
||||
tide_terraform_color 000000
|
||||
tide_terraform_icon
|
||||
tide_time_bg_color D3D7CF
|
||||
tide_time_color 000000
|
||||
tide_time_format '%T'
|
||||
|
@ -45,6 +45,8 @@ tide_status_bg_color black
|
||||
tide_status_bg_color_failure red
|
||||
tide_status_color green
|
||||
tide_status_color_failure bryellow
|
||||
tide_terraform_bg_color magenta
|
||||
tide_terraform_color black
|
||||
tide_time_bg_color white
|
||||
tide_time_color black
|
||||
tide_vi_mode_bg_color_default green
|
||||
|
19
tests/_tide_item_terraform.test.fish
Normal file
19
tests/_tide_item_terraform.test.fish
Normal file
@ -0,0 +1,19 @@
|
||||
# RUN: %fish %s
|
||||
|
||||
function _terraform
|
||||
_tide_decolor (_tide_item_terraform)
|
||||
end
|
||||
|
||||
set -l terraformDir (mktemp -d)
|
||||
cd $terraformDir
|
||||
|
||||
mock terraform "workspace show" "echo default"
|
||||
_terraform # CHECK:
|
||||
|
||||
mkdir .terraform
|
||||
_terraform # CHECK:
|
||||
|
||||
mock terraform "workspace show" "echo test"
|
||||
_terraform # CHECK: test
|
||||
|
||||
rm -r $terraformDir
|
Loading…
Reference in New Issue
Block a user