mirror of
https://github.com/IlanCosman/tide.git
synced 2024-09-11 17:15:34 +03:00
parent
be131a5560
commit
6a9d3e2749
8
functions/_tide_item_gcloud.fish
Normal file
8
functions/_tide_item_gcloud.fish
Normal file
@ -0,0 +1,8 @@
|
||||
function _tide_item_gcloud
|
||||
set -q CLOUDSDK_CONFIG || set -l CLOUDSDK_CONFIG ~/.config/gcloud
|
||||
path is $CLOUDSDK_CONFIG/active_config \
|
||||
&& read -l config <$CLOUDSDK_CONFIG/active_config \
|
||||
&& path is $CLOUDSDK_CONFIG/configurations/config_$config \
|
||||
&& string match -qr '^\s*project\s*=\s*(?<project>.*)' <$CLOUDSDK_CONFIG/configurations/config_$config \
|
||||
&& _tide_print_item gcloud $tide_gcloud_icon' ' $project
|
||||
end
|
@ -1,7 +1,7 @@
|
||||
function _tide_remove_unusable_items
|
||||
# Remove tool-specific items for tools the machine doesn't have installed
|
||||
set -l removed_items
|
||||
for item in aws chruby crystal distrobox docker elixir git go java kubectl nix_shell node php pulumi rustc terraform toolbox virtual_env
|
||||
for item in aws chruby crystal distrobox docker elixir gcloud git go java kubectl nix_shell node php pulumi rustc terraform toolbox virtual_env
|
||||
set -l cli_names $item
|
||||
switch $item
|
||||
case distrobox # there is no 'distrobox' command inside the container
|
||||
|
@ -34,6 +34,9 @@ tide_docker_icon
|
||||
tide_elixir_bg_color 444444
|
||||
tide_elixir_color 4E2A8E
|
||||
tide_elixir_icon
|
||||
tide_gcloud_bg_color 444444
|
||||
tide_gcloud_color 4285F4
|
||||
tide_gcloud_icon
|
||||
tide_git_bg_color 444444
|
||||
tide_git_bg_color_unstable 444444
|
||||
tide_git_bg_color_urgent 444444
|
||||
@ -99,7 +102,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 java php pulumi chruby go kubectl distrobox toolbox terraform aws nix_shell crystal elixir
|
||||
tide_right_prompt_items status cmd_duration context jobs node virtual_env rustc java php pulumi chruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir
|
||||
tide_right_prompt_prefix
|
||||
tide_right_prompt_separator_diff_color
|
||||
tide_right_prompt_separator_same_color
|
||||
|
@ -18,6 +18,8 @@ tide_docker_bg_color black
|
||||
tide_docker_color blue
|
||||
tide_elixir_bg_color black
|
||||
tide_elixir_color magenta
|
||||
tide_gcloud_bg_color black
|
||||
tide_gcloud_color blue
|
||||
tide_git_bg_color black
|
||||
tide_git_bg_color_unstable black
|
||||
tide_git_bg_color_urgent black
|
||||
|
@ -34,6 +34,9 @@ tide_docker_icon
|
||||
tide_elixir_bg_color normal
|
||||
tide_elixir_color 4E2A8E
|
||||
tide_elixir_icon
|
||||
tide_gcloud_bg_color normal
|
||||
tide_gcloud_color 4285F4
|
||||
tide_gcloud_icon
|
||||
tide_git_bg_color normal
|
||||
tide_git_bg_color_unstable normal
|
||||
tide_git_bg_color_urgent normal
|
||||
@ -99,7 +102,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 java php pulumi chruby go kubectl distrobox toolbox terraform aws nix_shell crystal elixir
|
||||
tide_right_prompt_items status cmd_duration context jobs node virtual_env rustc java php pulumi chruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir
|
||||
tide_right_prompt_prefix ' '
|
||||
tide_right_prompt_separator_diff_color ' '
|
||||
tide_right_prompt_separator_same_color ' '
|
||||
|
@ -18,6 +18,8 @@ tide_docker_bg_color normal
|
||||
tide_docker_color blue
|
||||
tide_elixir_bg_color normal
|
||||
tide_elixir_color magenta
|
||||
tide_gcloud_bg_color normal
|
||||
tide_gcloud_color blue
|
||||
tide_git_bg_color normal
|
||||
tide_git_bg_color_unstable normal
|
||||
tide_git_bg_color_urgent normal
|
||||
|
@ -34,6 +34,9 @@ tide_docker_icon
|
||||
tide_elixir_bg_color 4E2A8E
|
||||
tide_elixir_color 000000
|
||||
tide_elixir_icon
|
||||
tide_gcloud_bg_color 4285F4
|
||||
tide_gcloud_color 000000
|
||||
tide_gcloud_icon
|
||||
tide_git_bg_color 4E9A06
|
||||
tide_git_bg_color_unstable C4A000
|
||||
tide_git_bg_color_urgent CC0000
|
||||
@ -99,7 +102,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 java php pulumi chruby go kubectl distrobox toolbox terraform aws nix_shell crystal elixir
|
||||
tide_right_prompt_items status cmd_duration context jobs node virtual_env rustc java php pulumi chruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir
|
||||
tide_right_prompt_prefix
|
||||
tide_right_prompt_separator_diff_color
|
||||
tide_right_prompt_separator_same_color
|
||||
|
@ -18,6 +18,8 @@ tide_docker_bg_color blue
|
||||
tide_docker_color black
|
||||
tide_elixir_bg_color magenta
|
||||
tide_elixir_color black
|
||||
tide_gcloud_bg_color blue
|
||||
tide_gcloud_color black
|
||||
tide_git_bg_color green
|
||||
tide_git_bg_color_unstable yellow
|
||||
tide_git_bg_color_urgent red
|
||||
|
23
tests/_tide_item_gcloud.test.fish
Normal file
23
tests/_tide_item_gcloud.test.fish
Normal file
@ -0,0 +1,23 @@
|
||||
# RUN: %fish %s
|
||||
_tide_parent_dirs
|
||||
|
||||
function _gcloud
|
||||
_tide_decolor (_tide_item_gcloud)
|
||||
end
|
||||
|
||||
set -lx tide_gcloud_icon G
|
||||
set -l tmpdir (mktemp -d)
|
||||
cd $tmpdir
|
||||
set -lx HOME $tmpdir
|
||||
|
||||
_gcloud # CHECK:
|
||||
|
||||
mkdir -p $tmpdir/.config/gcloud
|
||||
echo default >$tmpdir/.config/gcloud/active_config
|
||||
_gcloud # CHECK:
|
||||
|
||||
mkdir -p $tmpdir/.config/gcloud/configurations
|
||||
echo "project = test" >$tmpdir/.config/gcloud/configurations/config_default
|
||||
_gcloud # CHECK: G test
|
||||
|
||||
command rm -r $tmpdir
|
Loading…
Reference in New Issue
Block a user