Upgrade Tide

This commit is contained in:
2025-08-08 13:09:49 +02:00
parent a62f7626d2
commit 7dad183fbf
15 changed files with 63 additions and 43 deletions

View File

@@ -10,9 +10,8 @@ function _tide_detect_os
printf %s\n  FFFFFF 00CCFF # https://answers.microsoft.com/en-us/windows/forum/all/what-is-the-official-windows-8-blue-rgb-or-hex/fd57144b-f69b-42d8-8c21-6ca911646e44
case linux
if test (uname -o) = Android
echo# This character is evil and messes up code display, so it's put on its own line
# https://developer.android.com/distribute/marketing-tools/brand-guidelines
printf %s\n 3DDC84 3C3F41 # fg is from above link, bg is from Android Studio default dark theme
printf %s\n 3DDC84 3C3F41 # fg is from above link, bg is from Android Studio default dark theme
else
_tide_detect_os_linux_cases /etc/os-release ID ||
_tide_detect_os_linux_cases /etc/os-release ID_LIKE ||

View File

@@ -0,0 +1,6 @@
function _tide_item_bun
if path is $_tide_parent_dirs/bun.lockb
bun --version | string match -qr "(?<v>.*)"
_tide_print_item bun $tide_bun_icon' ' $v
end
end

View File

@@ -50,7 +50,7 @@ function _tide_item_git
(0|(?<dirty>.*))\n(0|(?<untracked>.*))(\n(0|(?<behind>.*))\t(0|(?<ahead>.*)))?' \
"$(git $_set_dir_opt stash list 2>/dev/null | count
string match -r ^UU $stat | count
string match -r ^[ADMR]. $stat | count
string match -r ^[ADMR] $stat | count
string match -r ^.[ADMR] $stat | count
string match -r '^\?\?' $stat | count
git rev-list --count --left-right @{upstream}...HEAD 2>/dev/null)"

View File

@@ -1,7 +1,10 @@
function _tide_parent_dirs --on-variable PWD
set -g _tide_parent_dirs (string escape (
for dir in (string split / -- $PWD)
set -la parts $dir
string join / -- $parts
end))
set -g _tide_parent_dirs (
string escape (
for dir in (string split / -- $PWD)
set -fa parts $dir
string join / -- $parts
end
)
)
end

View File

@@ -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 crystal direnv distrobox docker elixir gcloud git go java kubectl nix_shell node php pulumi python ruby rustc terraform toolbox zig
for item in aws bun crystal direnv distrobox docker elixir gcloud git go java kubectl nix_shell node php pulumi python ruby rustc terraform toolbox zig
contains $item $tide_left_prompt_items $tide_right_prompt_items || continue
set -l cli_names $item

View File

@@ -11,14 +11,14 @@ function _tide_sub_bug-report
set --long | string match -r "^_?tide.*" | # Get only tide variables
string match -r --invert "^_tide_prompt_var.*" # Remove _tide_prompt_var
else
set -l fish_version ($fish_path --version | string match -r "fish, version (\d\.\d\.\d)")[2]
_tide_check_version Fish fish-shell/fish-shell "(\d\.\d\.\d)" $fish_version || return
$fish_path --version | string match -qr "fish, version (?<fish_version>.*)"
_tide_check_version Fish fish-shell/fish-shell "(?<v>[\d.]+)" $fish_version || return
set -l tide_version (tide --version | string match -r "tide, version (\d\.\d\.\d)")[2]
_tide_check_version Tide IlanCosman/tide "v(\d\.\d\.\d)" $tide_version || return
tide --version | string match -qr "tide, version (?<tide_version>.*)"
_tide_check_version Tide IlanCosman/tide "v(?<v>[\d.]+)" $tide_version || return
if command --query git
test (git --version | string match -r "git version ([\d\.]*)" | string replace --all . '')[2] -gt 2220
test (path sort (git --version) "git version 2.22.0")[1] = "git version 2.22.0"
_tide_check_condition \
"Your git version is too old." \
"Tide requires at least version 2.22." \
@@ -32,11 +32,12 @@ function _tide_sub_bug-report
"Please uninstall it before submitting a bug report." || return
if not set -q _flag_check
set -l fish_startup_time ($fish_path -ic "time $fish_path -c exit" 2>|
string match -r "Executed in(.*)fish" | string trim)[2]
$fish_path -ic "time $fish_path -c exit" 2>|
string match -rg "Executed in(.*)fish" |
string trim | read -l fish_startup_time
read --local --prompt-str "What operating system are you using? (e.g Ubuntu 20.04): " os
read --local --prompt-str "What terminal emulator are you using? (e.g Kitty): " terminal_emulator
read -l --prompt-str "What operating system are you using? (e.g Ubuntu 20.04): " os
read -l --prompt-str "What terminal emulator are you using? (e.g Kitty): " terminal_emulator
printf '%b\n' "\nPlease copy the following information into the issue:\n" \
"fish version: $fish_version" \
@@ -50,15 +51,14 @@ function _tide_sub_bug-report
end
end
function _tide_check_version -a program_name repo_name regex_to_get_version current_version
curl --silent https://github.com/$repo_name/releases/latest |
string match -r ".*$repo_name/releases/tag/$regex_to_get_version.*" |
read --local --line __ latestVersion
function _tide_check_version -a program_name repo_name regex_to_get_v installed_version
curl -sL https://github.com/$repo_name/releases/latest |
string match -qr "https://github.com/$repo_name/releases/tag/$regex_to_get_v"
string match --quiet -r "^$latestVersion" "$current_version"
string match -qr "^$v" "$installed_version" # Allow git versions, e.g 3.3.1-701-gceade1629
_tide_check_condition \
"Your $program_name version is out of date." \
"The latest is $latestVersion. You have $current_version." \
"The latest is $v. You have $installed_version." \
"Please update before submitting a bug report."
end

View File

@@ -28,7 +28,7 @@ if contains newline $_tide_left_items # two line prompt initialization
test "$tide_left_prompt_frame_enabled" = true &&
set -l top_left_frame "$prompt_and_frame_color╭─" &&
set -l bot_left_frame "$prompt_and_frame_color╰─" &&
set column_offset (math $column_offset-2)
set column_offset 3
test "$tide_right_prompt_frame_enabled" = true &&
set -l top_right_frame "$prompt_and_frame_color─╮" &&
set -l bot_right_frame "$prompt_and_frame_color─╯" &&
@@ -145,21 +145,20 @@ end"
end
end
eval "function _tide_on_fish_exit --on-event fish_exit
# Inheriting instead of evaling because here load time is more important than runtime
function _tide_on_fish_exit --on-event fish_exit --inherit-variable prompt_var
set -e $prompt_var
end"
end
if test "$tide_prompt_transient_enabled" = true
function _tide_enter_transient
# If the commandline will be executed, or is empty
if commandline --is-valid || test -z "$(commandline)"
# Pager open usually means selecting, not running
# Can be untrue, but it's better than the alternative
if not commandline --paging-mode
set -g _tide_transient
set -g _tide_repaint
commandline -f repaint
end
# If the commandline will be executed or is empty, and the pager is not open
# Pager open usually means selecting, not running
# Can be untrue, but it's better than the alternative
if commandline --is-valid || test -z "$(commandline)" && not commandline --paging-mode
set -g _tide_transient
set -g _tide_repaint
commandline -f repaint
end
commandline -f execute
end

View File

@@ -2,7 +2,7 @@ function tide --description 'Manage your Tide prompt'
argparse --stop-nonopt v/version h/help -- $argv
if set -q _flag_version
echo 'tide, version 6.1.1'
echo 'tide, version 6.2.0'
else if set -q _flag_help
_tide_help
else if functions --query _tide_sub_$argv[1]

View File

@@ -1,5 +1,7 @@
tide_aws_bg_color 444444
tide_aws_color FF9900
tide_bun_bg_color 14151A
tide_bun_color FBF0DF
tide_character_color $_tide_color_green
tide_character_color_failure FF0000
tide_cmd_duration_bg_color 444444
@@ -77,11 +79,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 build.zig
tide_pwd_markers .bzr .citc .git .hg .node-version .python-version .ruby-version .shorten_folder_marker .svn .terraform bun.lockb 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 zig
tide_right_prompt_items status cmd_duration context jobs direnv bun 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

View File

@@ -1,5 +1,7 @@
tide_aws_bg_color black
tide_aws_color yellow
tide_bun_bg_color black
tide_bun_color white
tide_character_color brgreen
tide_character_color_failure brred
tide_cmd_duration_bg_color black

View File

@@ -1,5 +1,7 @@
tide_aws_bg_color normal
tide_aws_color FF9900
tide_bun_bg_color normal
tide_bun_color FBF0DF
tide_character_color $_tide_color_green
tide_character_color_failure FF0000
tide_cmd_duration_bg_color normal
@@ -77,11 +79,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 build.zig
tide_pwd_markers .bzr .citc .git .hg .node-version .python-version .ruby-version .shorten_folder_marker .svn .terraform bun.lockb 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 zig
tide_right_prompt_items status cmd_duration context jobs direnv bun 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 ' '

View File

@@ -1,5 +1,7 @@
tide_aws_bg_color normal
tide_aws_color yellow
tide_bun_bg_color normal
tide_bun_color white
tide_character_color brgreen
tide_character_color_failure brred
tide_cmd_duration_bg_color normal

View File

@@ -1,5 +1,7 @@
tide_aws_bg_color FF9900
tide_aws_color 232F3E
tide_bun_bg_color FBF0DF
tide_bun_color 14151A
tide_character_color $_tide_color_green
tide_character_color_failure FF0000
tide_cmd_duration_bg_color C4A000
@@ -77,11 +79,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 build.zig
tide_pwd_markers .bzr .citc .git .hg .node-version .python-version .ruby-version .shorten_folder_marker .svn .terraform bun.lockb 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 zig
tide_right_prompt_items status cmd_duration context jobs direnv bun 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

View File

@@ -1,5 +1,7 @@
tide_aws_bg_color yellow
tide_aws_color brblack
tide_bun_bg_color white
tide_bun_color black
tide_character_color brgreen
tide_character_color_failure brred
tide_cmd_duration_bg_color yellow

View File

@@ -1,4 +1,5 @@
tide_aws_icon# Actual aws glyph is harder to see
tide_bun_icon 󰳓
tide_character_icon
tide_character_vi_icon_default
tide_character_vi_icon_replace