From d3a0265e73f769209fcbc8ac0965f8271e7aebed Mon Sep 17 00:00:00 2001 From: Julian Vesper Date: Sat, 7 Oct 2023 00:09:42 +0200 Subject: [PATCH] Add Zig item --- functions/_tide_item_zig.fish | 6 +++++ functions/tide/configure/configs/classic.fish | 6 +++-- .../configure/configs/classic_16color.fish | 2 ++ functions/tide/configure/configs/lean.fish | 6 +++-- .../tide/configure/configs/lean_16color.fish | 2 ++ functions/tide/configure/configs/rainbow.fish | 6 +++-- .../configure/configs/rainbow_16color.fish | 2 ++ functions/tide/configure/icons.fish | 1 + tests/_tide_item_zig.test.fish | 22 +++++++++++++++++++ 9 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 functions/_tide_item_zig.fish create mode 100644 tests/_tide_item_zig.test.fish diff --git a/functions/_tide_item_zig.fish b/functions/_tide_item_zig.fish new file mode 100644 index 00000000..2ac27412 --- /dev/null +++ b/functions/_tide_item_zig.fish @@ -0,0 +1,6 @@ +function _tide_item_zig + if path is $_tide_parent_dirs/build.zig + zig version | string match -qr "(?[\d.]+(-dev)?)" + _tide_print_item zig $tide_zig_icon' ' $v + end +end diff --git a/functions/tide/configure/configs/classic.fish b/functions/tide/configure/configs/classic.fish index 86d2298a..e7600150 100644 --- a/functions/tide/configure/configs/classic.fish +++ b/functions/tide/configure/configs/classic.fish @@ -76,11 +76,11 @@ tide_pwd_bg_color 444444 tide_pwd_color_anchors $_tide_color_light_blue tide_pwd_color_dirs $_tide_color_dark_blue tide_pwd_color_truncated_dirs 8787AF -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_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 build.zig tide_python_bg_color 444444 tide_python_color 00AFAF tide_right_prompt_frame_enabled true -tide_right_prompt_items status cmd_duration context jobs direnv node python rustc java php pulumi ruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir +tide_right_prompt_items status cmd_duration context jobs direnv node python rustc java php pulumi ruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir zig tide_right_prompt_prefix  tide_right_prompt_separator_diff_color  tide_right_prompt_separator_same_color  @@ -111,3 +111,5 @@ tide_vi_mode_color_default 949494 tide_vi_mode_color_insert 87AFAF tide_vi_mode_color_replace 87AF87 tide_vi_mode_color_visual FF8700 +tide_zig_bg_color 444444 +tide_zig_color F7A41D diff --git a/functions/tide/configure/configs/classic_16color.fish b/functions/tide/configure/configs/classic_16color.fish index 932279a0..670170f5 100644 --- a/functions/tide/configure/configs/classic_16color.fish +++ b/functions/tide/configure/configs/classic_16color.fish @@ -85,3 +85,5 @@ tide_vi_mode_color_default white tide_vi_mode_color_insert cyan tide_vi_mode_color_replace green tide_vi_mode_color_visual yellow +tide_zig_bg_color black +tide_zig_color yellow diff --git a/functions/tide/configure/configs/lean.fish b/functions/tide/configure/configs/lean.fish index 8208e6ed..9ef082f0 100644 --- a/functions/tide/configure/configs/lean.fish +++ b/functions/tide/configure/configs/lean.fish @@ -76,11 +76,11 @@ tide_pwd_bg_color normal tide_pwd_color_anchors $_tide_color_light_blue tide_pwd_color_dirs $_tide_color_dark_blue tide_pwd_color_truncated_dirs 8787AF -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_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 build.zig tide_python_bg_color normal tide_python_color 00AFAF tide_right_prompt_frame_enabled false -tide_right_prompt_items status cmd_duration context jobs direnv node python rustc java php pulumi ruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir +tide_right_prompt_items status cmd_duration context jobs direnv node python rustc java php pulumi ruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir zig tide_right_prompt_prefix ' ' tide_right_prompt_separator_diff_color ' ' tide_right_prompt_separator_same_color ' ' @@ -111,3 +111,5 @@ tide_vi_mode_color_default 949494 tide_vi_mode_color_insert 87AFAF tide_vi_mode_color_replace 87AF87 tide_vi_mode_color_visual FF8700 +tide_zig_bg_color normal +tide_zig_color F7A41D diff --git a/functions/tide/configure/configs/lean_16color.fish b/functions/tide/configure/configs/lean_16color.fish index 5a1f7265..16c2511d 100644 --- a/functions/tide/configure/configs/lean_16color.fish +++ b/functions/tide/configure/configs/lean_16color.fish @@ -85,3 +85,5 @@ tide_vi_mode_color_default white tide_vi_mode_color_insert cyan tide_vi_mode_color_replace green tide_vi_mode_color_visual yellow +tide_zig_bg_color normal +tide_zig_color yellow diff --git a/functions/tide/configure/configs/rainbow.fish b/functions/tide/configure/configs/rainbow.fish index 241895c0..521477f2 100644 --- a/functions/tide/configure/configs/rainbow.fish +++ b/functions/tide/configure/configs/rainbow.fish @@ -76,11 +76,11 @@ tide_pwd_bg_color 3465A4 tide_pwd_color_anchors E4E4E4 tide_pwd_color_dirs E4E4E4 tide_pwd_color_truncated_dirs BCBCBC -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_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 build.zig tide_python_bg_color 444444 tide_python_color 00AFAF tide_right_prompt_frame_enabled true -tide_right_prompt_items status cmd_duration context jobs direnv node python rustc java php pulumi ruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir +tide_right_prompt_items status cmd_duration context jobs direnv node python rustc java php pulumi ruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir zig tide_right_prompt_prefix  tide_right_prompt_separator_diff_color  tide_right_prompt_separator_same_color  @@ -111,3 +111,5 @@ tide_vi_mode_color_default 000000 tide_vi_mode_color_insert 000000 tide_vi_mode_color_replace 000000 tide_vi_mode_color_visual 000000 +tide_zig_bg_color F7A41D +tide_zig_color 000000 diff --git a/functions/tide/configure/configs/rainbow_16color.fish b/functions/tide/configure/configs/rainbow_16color.fish index 148f3dfe..a040f584 100644 --- a/functions/tide/configure/configs/rainbow_16color.fish +++ b/functions/tide/configure/configs/rainbow_16color.fish @@ -89,3 +89,5 @@ tide_vi_mode_icon_default D tide_vi_mode_icon_insert I tide_vi_mode_icon_replace R tide_vi_mode_icon_visual V +tide_zig_bg_color yellow +tide_zig_color black diff --git a/functions/tide/configure/icons.fish b/functions/tide/configure/icons.fish index f2d405bc..f6805954 100644 --- a/functions/tide/configure/icons.fish +++ b/functions/tide/configure/icons.fish @@ -37,3 +37,4 @@ tide_vi_mode_icon_default D tide_vi_mode_icon_insert I tide_vi_mode_icon_replace R tide_vi_mode_icon_visual V +tide_zig_icon  diff --git a/tests/_tide_item_zig.test.fish b/tests/_tide_item_zig.test.fish new file mode 100644 index 00000000..3387962a --- /dev/null +++ b/tests/_tide_item_zig.test.fish @@ -0,0 +1,22 @@ +# RUN: %fish %s +_tide_parent_dirs + +function _zig + _tide_decolor (_tide_item_zig) +end + +set -l zigDir (mktemp -d) +cd $zigDir + +mock zig version "echo 0.11.0" +set -lx tide_zig_icon  + +_zig # CHECK: + +touch build.zig +_zig # CHECK:  0.11.0 + +mock zig version "echo 0.12.0-dev.789+e6590fea1" +_zig # CHECK:  0.12.0-dev + +command rm -r $zigDir