feat: introduce notty flag for version command#82
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a --noterminal option to the foc-devnet version subcommand so version output can be emitted without tracing formatting/prefixes, enabling cleaner capture by scripts/reporters.
Changes:
- Extend the CLI
Versionsubcommand to accept a--noterminalboolean flag. - Update
main.rsrouting to pass the flag through to the version handler. - Refactor version output to conditionally emit via
tracing::info!vsprintln!, and extract relative-time formatting into a helper.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/main_app/version.rs |
Adds conditional emission (plain vs tracing) and factors out relative time formatting. |
src/main.rs |
Routes Commands::Version { noterminal } into the updated handler signature. |
src/cli.rs |
Adds the --noterminal flag to the version subcommand. |
|
@redpanda-f I've opened a new pull request, #86, to work on those changes. Once the pull request is ready, I'll request review from you. |
…ive_time` (#86) * Initial plan * refactor: replace magic numbers with named constants in format_relative_time Co-authored-by: redpanda-f <181817029+redpanda-f@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: redpanda-f <181817029+redpanda-f@users.noreply.github.com>
rvagg
left a comment
There was a problem hiding this comment.
A couple items:
-
plainor some other standard idiom would be preferred tonoterminal, evennottywould be better; the more idiomatic a tool the better feel it has so always reach for something common -
why not just detect, this is the normal approach to such things and then you don't even need to think about it:
use std::io::IsTerminal;
let plain = !std::io::stdout().is_terminal();
Let me try this approach |
|
Fixed, added |
PR offshoot of #72, needed for cleaner report generation.