Make tide bug-report check that Tide and Fish are up to date

This commit is contained in:
Ilan Cosman 2021-03-30 13:53:41 -07:00
parent f9d47a8f4f
commit 0d306fe85b

View File

@ -6,12 +6,32 @@ function _tide_sub_bug-report
https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish |
source && fisher install ilancosman/tide"
else if set -q _flag_verbose
printf '%s\n' $TERM
set --long | string match --regex "^_?tide.*" | # Get only tide variables
string match --regex --invert "^_tide_.*_prompt_display_.*" | # Remove _tide_left_prompt_display_5770 etc
string match --regex --invert "^_tide_var_list.*" # Remove _tide_var_list
else
fish --version
tide --version
printf '%s\n' $TERM
set -l currentFishVersion (fish --version | string match --regex "fish, version (\d\.\d\.\d)")[2]
_tide_check_version Fish fish-shell/fish-shell "(\d\.\d\.\d)" $currentFishVersion || return
set -l currentTideVersion (tide --version | string match --regex "tide, version (\d\.\d\.\d)")[2]
_tide_check_version Tide IlanCosman/tide "v(\d\.\d\.\d)" $currentTideVersion || return
end
end
function _tide_check_version -a programName repoName regexToGetVersion currentVersion
curl --silent https://github.com/$repoName/releases/latest |
string match --regex ".*$repoName/releases/tag/$regexToGetVersion.*" |
read --local --line __ latestVersion
string match --quiet --regex "^$latestVersion" "$currentVersion" && return
set_color red
printf '%s\n' \
"Your $programName version is out of date." \
"The latest is $latestVersion. You have $currentVersion." \
"Please update before submitting a bug report."
set_color normal
return 1
end