asdf
asdf copied to clipboard
`asdf plugin list` should return a 0 exit code when no plugins are installed
I'm using ansible to bootstrap a development environment. Part of this process is installing asdf along with some plugins. Prior to installing a plugin, I run asdf plugin list to see if that plugin is already installed. When no plugins are installed, asdf plugin list will return a non-zero exit code - which ansible recognizes as a failure. To me, having no plugins and attempting to list all installed plugins should just return an empty list - not a failure code.
It's not a big deal though - the workaround I'm doing is:
- name: get asdf plugin list
command:
cmd: "asdf plugin list"
register: asdf_plugin_list
failed_when: asdf_plugin_list.rc != 0 and 'No plugins installed' not in asdf_plugin_list.stderr
Buuut, I wouldn't mind throwing up a PR to address this if you're willing!
We have many people requesting many different behaviours of errors and exit codes. For greater context, can you find the original PR/issue that introduced this so we can capture the history of the decision before we consider a change?
Sure! Here's the originating PR:
https://github.com/asdf-vm/asdf/pull/273
Lol, it was me! Since this isn't technically an error in the tool, I am happy for this to be changed to exit 0 and to not use display_error, but rather just print the information with printf to the user.
Sure! I can throw up a PR. Thanks for getting back to me!