asdf icon indicating copy to clipboard operation
asdf copied to clipboard

`asdf plugin list` should return a 0 exit code when no plugins are installed

Open benfiola opened this issue 4 years ago • 4 comments

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!

benfiola avatar Mar 21 '21 02:03 benfiola

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?

jthegedus avatar Mar 22 '21 07:03 jthegedus

Sure! Here's the originating PR:

https://github.com/asdf-vm/asdf/pull/273

benfiola avatar Mar 23 '21 07:03 benfiola

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.

jthegedus avatar Apr 03 '21 04:04 jthegedus

Sure! I can throw up a PR. Thanks for getting back to me!

benfiola avatar Apr 03 '21 05:04 benfiola