Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): add --quiet / -q option #281

Merged
merged 10 commits into from
Jan 30, 2023
Merged

Conversation

aarondill
Copy link
Contributor

This PR creates a --quiet (-q) option that simply stops the CLI from outputting success messages. Node errors and file-not-found errors are still outputted.

Tests have not been written, because the current testing infrastructure doesn't seem to have a way to automatically test the stdout of a CLI call.
closes #280

Stops any successful output. Errors are still outputted.
@keithamus
Copy link
Owner

I would prefer an if check, or alternatively making a log function which encapsulates both the if check and the console.log statement. Overriding globals can cause confusion or maintenance issues.

This commit creates stdout and stderr functions for outputting with
respect to isQuiet and adds support for differing (easier to parse)
messages if not connected to a TTY (eg. a pipe or process substitution)

Additionally changes the 'No matching files.' message to output on stderr
rather than on stdout as it was, which makes sense because this output
represents erroneous usage.
@aarondill
Copy link
Contributor Author

I have made this change in my updated PR at #283

@aarondill aarondill closed this Jan 22, 2023
--help and --version don't need to be checked because they
exit the program before reaching this point.
@aarondill aarondill reopened this Jan 23, 2023
@aarondill
Copy link
Contributor Author

This has been reopened as per @fisker's request. It has been updated to match the master branch + my modifications and should now be ready for review.

cli.js Outdated Show resolved Hide resolved
cli.js Outdated Show resolved Hide resolved
@aarondill aarondill requested a review from fisker January 23, 2023 04:34
@fisker
Copy link
Collaborator

fisker commented Jan 23, 2023

Can you add test for those flags?

@aarondill
Copy link
Contributor Author

I'm currently working on this on a separate branch. Once I finish, I can copy the relevant tests to this branch.

@aarondill
Copy link
Contributor Author

Tests have been added

@aarondill
Copy link
Contributor Author

@fisker any update on this PR? I saw that you approved it, are we waiting for @keithamus to approve it or is there another holdup that I don't know about?

@fisker
Copy link
Collaborator

fisker commented Jan 30, 2023

Let's wait for @keithamus to take a look.

Copy link
Owner

@keithamus keithamus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 nice work @aarondill 🎉

Thanks @fisker for reviewing and helping get this into great shape!

@keithamus keithamus merged commit f268402 into keithamus:master Jan 30, 2023
@github-actions
Copy link

🎉 This PR is included in version 2.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@aarondill aarondill deleted the master branch February 1, 2023 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Quiet CLI option to oppress success output
3 participants