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

Rewrite a lot of the CLI for easier testing #1257

Merged
merged 3 commits into from
Jun 13, 2022
Merged

Conversation

mtdowling
Copy link
Member

@mtdowling mtdowling commented Jun 4, 2022

This commit moves most CLI output to stderr, updates Colors to become
Color, makes Color return formatted text rather than print, adds a
CliPrinter interface that manages printing to stdout/stderr, and allows
commands to use per/command printers to make testing easier. This change
is still backwards compatible with the existing static setters that are
used by the smithy-gradle-plugin.

This commit also adds support for --quiet to all commands. This option silences all output except for errors and SEVERE log messages.

Closes #1195

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

This commit moves most CLI output to stderr, updates Colors to become
Color, makes Color return formatted text rather than print, adds a
CliPrinter interface that manages printing to stdout/stderr, and allows
commands to use per/command printers to make testing easier. This change
is still backwards compatible with the existing static setters that are
used by the smithy-gradle-plugin.

Addresses #1195
@mtdowling mtdowling requested a review from a team as a code owner June 4, 2022 05:57
@mtdowling mtdowling changed the title Cleanup CLI printing Rewrite a lot of the CLI for easier testing Jun 6, 2022
@mtdowling mtdowling force-pushed the refactor-cli-printing branch 2 times, most recently from e336ecf to 4f81d24 Compare June 6, 2022 06:22
@mtdowling mtdowling marked this pull request as draft June 6, 2022 06:48
@mtdowling mtdowling force-pushed the refactor-cli-printing branch 2 times, most recently from 2b3807d to 9140628 Compare June 6, 2022 15:57
@mtdowling mtdowling marked this pull request as ready for review June 6, 2022 16:43
@mtdowling mtdowling force-pushed the refactor-cli-printing branch 8 times, most recently from 059cd3f to 42e5085 Compare June 8, 2022 00:04
This commit rewrites much of the CLI to make it easier to test, provide
more control over colors and styling, more control over command argument
parsing, and attempts to better handle logging.

Followups to this commit are to add support for --silent and potentially
add support for controlling the number of threads used by the CLI by
passing an executor through to everything.
@mtdowling mtdowling force-pushed the refactor-cli-printing branch from 42e5085 to f8e5bf5 Compare June 10, 2022 05:51
This commit updates commands so that there is now a HelpPrinter
abstraction used to manage printing help.
@mtdowling mtdowling requested a review from JordonPhillips June 11, 2022 00:06
@mtdowling mtdowling merged commit b59f9f8 into main Jun 13, 2022
@mtdowling mtdowling deleted the refactor-cli-printing branch July 29, 2022 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants