Merge pull request #135 from asdf-vm/install-command-error-msg

Add a helpful error message to the install command.
This commit is contained in:
Trevor Brown 2016-12-19 06:39:28 -07:00 committed by GitHub
commit 855dd3bcf1
2 changed files with 15 additions and 0 deletions

View File

@ -4,6 +4,9 @@ install_command() {
if [ "$plugin_name" = "" ] && [ "$full_version" = "" ]; then
install_local_tool_versions
elif [[ $# -eq 1 ]]; then
display_error "You must specify a name and a version to install"
exit 1
else
install_tool_version $plugin_name $full_version
fi

View File

@ -64,3 +64,15 @@ teardown() {
[ "$($ASDF_DIR/shims/dummy world hello)" == "This is Dummy 1.0! hello world" ]
[ "$status" -eq 0 ]
}
@test "install_command fails when the name or version are not specified" {
run install_command dummy
[ "$status" -eq 1 ]
[ "$output" = "You must specify a name and a version to install" ]
[ ! -f $ASDF_DIR/installs/dummy/1.1/version ]
run install_command 1.1
[ "$status" -eq 1 ]
[ "$output" = "You must specify a name and a version to install" ]
[ ! -f $ASDF_DIR/installs/dummy/1.1/version ]
}