Commit 5764f0d9 authored by Itzik Ephraim's avatar Itzik Ephraim

`omf doctor` checks for fish & git versions

Minimum fish version: 2.2.0
Minimum git version: 1.9.5
parent 8de7eb4c
......@@ -3,7 +3,6 @@ function __omf.doctor.theme
echo (omf::err)"Warning: "(omf::off)(omf::em)"fish_prompt.fish"(omf::off)" is overridden."
echo (omf::em)" fish_config"(omf::off)" command persists the prompt to "(omf::em)"~/.config/fish/functions/fish_prompt.fish"(omf::off)
echo " That file takes precedence over Oh My Fish's themes. Remove the file to fix it:"
echo (omf::em)" rm ~/.config/fish/functions/fish_prompt.fish"(omf::off)
echo
......@@ -13,7 +12,42 @@ function __omf.doctor.theme
return 0
end
function __omf.doctor.fish_version
set -l min_version 2.2.0
set -l current_version
begin
set -l IFS '-'
echo $FISH_VERSION | read -la version_parts
set current_version "$version_parts[1]"
end
if not omf.check.version $min_version $current_version
echo (omf::err)"Warning: "(omf::off)"Oh-My-Fish requires "(omf::em)"fish"(omf::off)" version "(omf::em)"$min_version"(omf::off)" or above"
echo "Your fish version is "(omf::em)$FISH_VERSION(omf::off)
echo
return 1
end
end
function __omf.doctor.git_version
set -l min_version 1.9.5
set -l current_version
begin
git --version | read -la version_parts
set current_version "$version_parts[3]"
end
if not omf.check.version $min_version $current_version
echo (omf::err)"Warning: "(omf::off)"Oh-My-Fish requires "(omf::em)"git"(omf::off)" version "(omf::em)"$min_version"(omf::off)" or above"
echo "Your git version is "(omf::em)$current_version(omf::off)
echo
return 1
end
end
function omf.doctor
__omf.doctor.fish_version; or set -l doctor_failed
__omf.doctor.git_version; or set -l doctor_failed
__omf.doctor.theme; or set -l doctor_failed
if set -q doctor_failed
......
function omf.check.version -a min_version -a current_version
test (echo "$min_version"\n"$current_version" | tr '.' ' ' | sort -n | head -n1) = (echo "$min_version" | tr '.' ' ')
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment