Merge pull request #280 from oranja/doctor-versions

`omf doctor` checks for fish & git versions
This commit is contained in:
Justin Hileman 2016-03-24 00:17:14 -07:00
commit 6323844b81
2 changed files with 38 additions and 1 deletions

View File

@ -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

View File

@ -0,0 +1,3 @@
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