asdf-yarn icon indicating copy to clipboard operation
asdf-yarn copied to clipboard

Tidy up the output during installation

Open canterberry opened this issue 3 years ago • 0 comments

Currently, the output of this plugin when installing a version is quite ugly and intimidating.

Screen Shot 2022-07-27 at 23 06 00

In this PR, I've made that output much cleaner for humans to read.

Screen Shot 2022-07-27 at 23 04 12

Notable Changes

  1. The -q flag is now being passed to wget commands, which are the primary offenders of the bulky output.
  2. The -q flag is now being passed to gpg commands, particularly the --verify command, which prints a spurious warning about the key not being trusted -- we can safely ignore that because we're using a dedicated keyring for this plugin where we've pulled the signing key from a trusted official source via a secure channel.
  3. Output is now consolidated to a single line, whether successful or failed, with a curated error message upon failure and an unambiguous confirmation upon success.

How to verify

# Install this plugin if it's not already installed
$ asdf plugin-add yarn

# Fetch the latest source and check out this PR's branch
$ (cd ~/.asdf/plugins/yarn && git fetch --all && git checkout quiet-gpg-and-wget)

# Install a real version of yarn to confirm it works as expected
$ asdf install yarn 1.22.19

# Install a non-existent version to confirm it fails as expected
$ asdf install yarn 1.3.37

Potential Issues

  • If my "prettification" here is too cute or garish, I accept that. I may have gone overboard. If you're on board with the goal of reducing spurious CLI output during install, but think I should rein it in, let me know.
  • I'm not sure how well this plugin works on Windows (if at all) and don't intend to test that myself. Any active Windows/WSL users out there, I'd appreciate your help validating these changes or spotting any obvious issues.

canterberry avatar Jul 28 '22 06:07 canterberry