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: get invalid ASDF_DATA_DIR when exec asdf shims by non-shell
asdf_data_dir function inits ASDF_DATA_DIR with HOME when value is empty.
HOME may replace to empty string when asdf shims called by non-shell program.
this makes invalid value of ASDF_DATA_DIR.
* 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
Ban recusive asdf calls as they are inefficient and may introduce bugs.
If you find yourself needing to invoke an `asdf` command from within
asdf code, please source the appropriate file and invoke the
corresponding function.
* 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
* Ban `ls` command
* Update banned commands test so it only checks bash and sh files
* Only allow `ls` for resolving symlinks
* Replace `ls` commands with `find`
* feat: Displays a warning when the plugin from the tools-version does not exist
When calling the install command, it tried to look for versions for all
the plugins available and installed them. With this change, it will attempt to
find versions for all the installed plugins and plugins defined in the
`.tool-versions`.
Fixes https://github.com/asdf-vm/asdf/issues/574
* feat: Changes the algorithm to detect not installed plugins
This patch changes the algorithm. It preserves the original logic for
the plugin resolution, but at the same time, reports entries with plugins not
available.
* fix: Addresses the pull request comments.
- Changes the comparison to be strict rather than partial.
- Prints a list of missing plugins.
- Exists if at least one plugin is not present.
- Adds unit tests.