assert fish version before asserting commands (#399)

* assert fish version before asserting commands

- fix #398 so that the correct error message is displayed

* move assert_cmds to after fish and git checks

- remove fish and git from assert_cmds, these checks are already done in their specific assert_ functions making them redundant in assert_cmds
- move function assert_cmds to match execution order
This commit is contained in:
Mathias Djärv 2016-09-16 17:49:36 +02:00 committed by Stephen M. Coakley
parent 4e48fcdcea
commit 543afc7c01

View File

@ -72,9 +72,9 @@ Options:
end end
# Ensure the environment meets all of the requirements. # Ensure the environment meets all of the requirements.
assert_cmds
assert_fish_version_compatible 2.2.0 assert_fish_version_compatible 2.2.0
assert_git_version_compatible 1.9.5 assert_git_version_compatible 1.9.5
assert_cmds
assert_interactive assert_interactive
# If the user wants to uninstall, jump to uninstallation and exit. # If the user wants to uninstall, jump to uninstallation and exit.
@ -441,17 +441,6 @@ function is_version_compatible -a lhs rhs
end end
# Assert that all tools we need are available.
function assert_cmds
set -l cmds basename cp cut date dirname fish fold git head mkdir mv rm sed sort tar tr
for cmd in $cmds
type -f -q $cmd
or abort "Command '$cmd' not found"
end
end
# Assert that a minimum required version of Fish is installed. # Assert that a minimum required version of Fish is installed.
function assert_fish_version_compatible -a required_version function assert_fish_version_compatible -a required_version
set -l installed_version (get_fish_version) set -l installed_version (get_fish_version)
@ -468,6 +457,17 @@ function assert_git_version_compatible -a required_version
end end
# Assert that all tools we need are available.
function assert_cmds
set -l cmds basename cp cut date dirname fold head mkdir mv rm sed sort tar tr
for cmd in $cmds
type -f -q $cmd
or abort "Command '$cmd' not found"
end
end
# Ensures the keyboard is readable if in interactive mode. # Ensures the keyboard is readable if in interactive mode.
function assert_interactive function assert_interactive
set -q NONINTERACTIVE set -q NONINTERACTIVE