Mercurial > public > mercurial-scm > hg
view rust/rhg/src/commands/debugrequirements.rs @ 49439:b07465adbcc8
rhg: make [rhg status -v] work when it needs no extra output
Add support for verbose [status] when no extra output is actually needed.
This makes it so that [rhg status] is actually useful when
[tweakdefaults] is true. (since tweakdefaults implies verbose status)
author | Arseniy Alekseyev <aalekseyev@janestreet.com> |
---|---|
date | Wed, 24 Aug 2022 16:38:13 +0100 |
parents | 5ce2aa7c2ad5 |
children | 37bc3edef76f |
line wrap: on
line source
use crate::error::CommandError; pub const HELP_TEXT: &str = " Print the current repo requirements. "; pub fn args() -> clap::App<'static, 'static> { clap::SubCommand::with_name("debugrequirements").about(HELP_TEXT) } pub fn run(invocation: &crate::CliInvocation) -> Result<(), CommandError> { let repo = invocation.repo?; let mut output = String::new(); let mut requirements: Vec<_> = repo.requirements().iter().collect(); requirements.sort(); for req in requirements { output.push_str(req); output.push('\n'); } invocation.ui.write_stdout(output.as_bytes())?; Ok(()) }