We need to add trailing newlines to .tool-versions file before appending
a new version to the file. The order of the checks was wrong here as the
first check assumed the file existed, and the second checked if it did.
Switching them fixes the issue.
This fix was provided by @h3y6e
Fixes#1417
If a .tool-versions file did not end with a newline new tools and
versions would get appended to the same line rather than properly
added on a new line in the file
Fixes#1299
* fix: always use ASDF_DEFAULT_TOOL_VERSIONS_FILENAME for filename when present
* fix: correct version command unit tests for ASDF_DEFAULT_TOOL_VERSIONS_FILENAME
Fixes#1082
* fix: don't invoke asdf inside asdf commands
Recursive calls have a number of disadvantages:
* Poorer performance since each invocation spawns and new process and re-executes all the code in bin/asdf
* Makes debugging more difficult
* More likely to introduce subtle bugs and the possibility for infinite loops