2020-07-15 04:30:58 +03:00
|
|
|
function _tide_sub_bug-report
|
2021-03-02 20:46:40 +03:00
|
|
|
argparse c/clean v/verbose -- $argv
|
2020-09-03 21:49:37 +03:00
|
|
|
|
2021-02-03 23:57:13 +03:00
|
|
|
if set -q _flag_clean
|
|
|
|
HOME=(mktemp -d) fish --init-command "curl --silent \
|
|
|
|
https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish |
|
2021-08-12 01:03:58 +03:00
|
|
|
source && fisher install ilancosman/tide@v5"
|
2021-02-03 23:57:13 +03:00
|
|
|
else if set -q _flag_verbose
|
2021-03-08 22:07:47 +03:00
|
|
|
set --long | string match --regex "^_?tide.*" | # Get only tide variables
|
2021-08-13 14:49:48 +03:00
|
|
|
string match --regex --invert "^_tide_prompt_var.*" | # Remove _tide_prompt_var
|
|
|
|
string match --regex --invert "^_tide_prompt_data.*" | # Remove _tide_prompt_data
|
2021-03-08 22:07:47 +03:00
|
|
|
string match --regex --invert "^_tide_var_list.*" # Remove _tide_var_list
|
2021-02-03 23:57:13 +03:00
|
|
|
else
|
2021-05-12 23:13:51 +03:00
|
|
|
set -l fish_version (fish --version | string match --regex "fish, version (\d\.\d\.\d)")[2]
|
|
|
|
_tide_check_version Fish fish-shell/fish-shell "(\d\.\d\.\d)" $fish_version || return
|
2021-03-30 23:53:41 +03:00
|
|
|
|
2021-05-12 23:13:51 +03:00
|
|
|
set -l tide_version (tide --version | string match --regex "tide, version (\d\.\d\.\d)")[2]
|
|
|
|
_tide_check_version Tide IlanCosman/tide "v(\d\.\d\.\d)" $tide_version || return
|
2021-04-13 02:48:01 +03:00
|
|
|
|
2021-05-26 19:12:21 +03:00
|
|
|
test (git --version | string match --regex "git version ([\d\.]*)" | string replace --all '.' '')[2] -gt 2220
|
|
|
|
_tide_check_condition \
|
|
|
|
"Your git version is too old." \
|
|
|
|
"Tide requires at least version 2.22." \
|
|
|
|
"Please update before submitting a bug report." || return
|
|
|
|
|
2021-04-13 02:48:01 +03:00
|
|
|
# Check that omf is not installed
|
2021-04-13 03:35:35 +03:00
|
|
|
not functions --query omf
|
2021-04-13 02:48:01 +03:00
|
|
|
_tide_check_condition \
|
|
|
|
"Tide does not work with oh-my-fish installed." \
|
2021-04-13 03:35:35 +03:00
|
|
|
"Please uninstall it before submitting a bug report." || return
|
|
|
|
|
2021-09-04 05:32:14 +03:00
|
|
|
set -l fish_startup_time (fish --command "time fish -c exit" 2>&1 |
|
|
|
|
string match --regex "Executed in(.*)fish" | string trim)[2]
|
|
|
|
|
2021-09-04 05:39:44 +03:00
|
|
|
set -l fisher_plugins (string join ', ' $_fisher_plugins)
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2021-04-13 03:35:35 +03:00
|
|
|
printf '%b\n' "\nPlease copy the following information into the issue:\n" \
|
2021-05-12 23:13:51 +03:00
|
|
|
"fish version: $fish_version" \
|
|
|
|
"tide version: $tide_version" \
|
2021-04-13 03:35:35 +03:00
|
|
|
"term: $TERM" \
|
|
|
|
"os: $os" \
|
2021-09-04 05:32:14 +03:00
|
|
|
"terminal emulator: $terminal_emulator" \
|
2021-09-04 05:39:44 +03:00
|
|
|
"fish startup: $fish_startup_time" \
|
|
|
|
"fisher plugins: $fisher_plugins"
|
2020-06-07 04:43:37 +03:00
|
|
|
end
|
2021-03-02 20:46:40 +03:00
|
|
|
end
|
2021-03-30 23:53:41 +03:00
|
|
|
|
2021-05-12 23:13:51 +03:00
|
|
|
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 --regex ".*$repo_name/releases/tag/$regex_to_get_version.*" |
|
2021-03-30 23:53:41 +03:00
|
|
|
read --local --line __ latestVersion
|
|
|
|
|
2021-05-12 23:13:51 +03:00
|
|
|
string match --quiet --regex "^$latestVersion" "$current_version"
|
2021-04-13 02:48:01 +03:00
|
|
|
_tide_check_condition \
|
2021-05-12 23:13:51 +03:00
|
|
|
"Your $program_name version is out of date." \
|
|
|
|
"The latest is $latestVersion. You have $current_version." \
|
2021-04-13 02:48:01 +03:00
|
|
|
"Please update before submitting a bug report."
|
|
|
|
end
|
|
|
|
|
|
|
|
function _tide_check_condition
|
2021-04-13 03:35:35 +03:00
|
|
|
if test "$status" != 0
|
2021-03-31 01:29:21 +03:00
|
|
|
set_color red
|
2021-04-13 03:35:35 +03:00
|
|
|
printf '%s\n' $argv
|
|
|
|
set_color normal
|
|
|
|
return 1
|
2021-03-31 01:29:21 +03:00
|
|
|
end
|
2021-04-13 03:35:35 +03:00
|
|
|
return 0
|
2021-03-30 23:53:41 +03:00
|
|
|
end
|