-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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: add foundry_common::shell
to unify log behavior
#9109
Conversation
…ss, for some reason cfg!(test) path is not handled when running with tokio tests
if possible, we can do this in smaller chunks because this pr is a conflict magnet |
foundry_common::shell
to unify log behavior
Noted, I've tried to keep the changes to a minimum but due to the nature of the PR there are a lot of small changes across many files. I've not replaced any |
…error message content in red - both not bold
Applied fixes from review cc @DaniPopes, would you mind checking one more time? To avoid visual regression, applied a change to style warning message content in yellow and error message content in red. |
Applied a minor fix for conditional rendering of failed tests when |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid visual regression, applied a change to style warning message content in yellow and error message content in red.
This is not right, only the "warn"/"error" should be styled
…yle formatting - no longer style the message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
high level review, lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
) * replace existing shell::println, add macros * finish replacing shell::println * remove p_println * remove redundant quiet or silent variables * install global shells in binaries * CastArgs -> Cast, Cast -> CastInstance * fix tests, always initialize Mutex::new(Shell::new()) on initial access, for some reason cfg!(test) path is not handled when running with tokio tests * revert .quiet(true) * add back quiet * undo CastInstance -> Cast, Cast -> CastArgs * add global --json format * use global --json flag * revert sequence / multisequence save silent mode * fix failing tests * fix tests * fix tests * replace cli_warn with sh_warn * use shell json directly instead of passing in * clean up, document print modes in respect to --quiet flag * group shell options under display options * revert global --json flag * remove redundant import * fix: quiet * remove faulty argument conflict test as there is no way to currently assert a conflict between global and local args without custom reject at runtime * add back conflicts_with quiet flag, global args w/ conflicts_with works fine * remove yellow() * Apply suggestions from code review - update dependencies - use default Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com> * fix deprecated terminal_size method * revert quiet flag, fix os:fd import for windows * add replacing tests, add back quiet conflicting flag * make output windows compatible * to avoid visual regression, style warning message content in yellow, error message content in red - both not bold * fix docs links * fix junit throwing mixed content on warnings, avoid modifying global verbosity * remove set_verbosity shell helper, redundant * revert default .expect on printing, prefer passing. revert message style formatting - no longer style the message * fix doc test, fix formatting * fix merge issues --------- Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com>
) * replace existing shell::println, add macros * finish replacing shell::println * remove p_println * remove redundant quiet or silent variables * install global shells in binaries * CastArgs -> Cast, Cast -> CastInstance * fix tests, always initialize Mutex::new(Shell::new()) on initial access, for some reason cfg!(test) path is not handled when running with tokio tests * revert .quiet(true) * add back quiet * undo CastInstance -> Cast, Cast -> CastArgs * add global --json format * use global --json flag * revert sequence / multisequence save silent mode * fix failing tests * fix tests * fix tests * replace cli_warn with sh_warn * use shell json directly instead of passing in * clean up, document print modes in respect to --quiet flag * group shell options under display options * revert global --json flag * remove redundant import * fix: quiet * remove faulty argument conflict test as there is no way to currently assert a conflict between global and local args without custom reject at runtime * add back conflicts_with quiet flag, global args w/ conflicts_with works fine * remove yellow() * Apply suggestions from code review - update dependencies - use default Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com> * fix deprecated terminal_size method * revert quiet flag, fix os:fd import for windows * add replacing tests, add back quiet conflicting flag * make output windows compatible * to avoid visual regression, style warning message content in yellow, error message content in red - both not bold * fix docs links * fix junit throwing mixed content on warnings, avoid modifying global verbosity * remove set_verbosity shell helper, redundant * revert default .expect on printing, prefer passing. revert message style formatting - no longer style the message * fix doc test, fix formatting * fix merge issues --------- Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com>
Motivation
To unify the shell implementation for improved consistency.
Solution
stdout
on logs (sh_println!
) andstderr
on warnings and errors (sh_eprintln!
,sh_warn!
,sh_err!
). If an error occurs upon rendering it is fowarded.--quiet
/-q
flag, easily checked against withshell::is_quiet()
for conditional logicp_println
,cli_warn
,shell::println
etc..Changes from initial common shell implementation:
sh_println!
/sh_eprintln!
/sh_warn!
now all listen to the--quiet
flagsh_println!
as opposed tosh_eprintln!
stderr
outputVisual changes:
Old:
New:
This first PR is the set of minimal changes, a follow up will be done to add it everywhere and to also solve the issues explicitly in #8794