Mercurial > public > mercurial-scm > hg
view rust/rhg/src/commands/debugrequirements.rs @ 49640:37bc3edef76f
rhg: upgrade `clap` dependency
This one is the worst one to upgrade since v2 -> v4 broke a ton of API,
which thankfully seems saner now.
Contrary to what was done in the `hg-core/src/examples/nodemap` rewrite,
we're not switching from the "builder" pattern to the "derive" pattern,
since that would imply a much larger diff. It can be done incrementally.
author | Rapha?l Gom?s <rgomes@octobus.net> |
---|---|
date | Tue, 15 Nov 2022 00:02:43 +0100 |
parents | 5ce2aa7c2ad5 |
children |
line wrap: on
line source
use crate::error::CommandError; pub const HELP_TEXT: &str = " Print the current repo requirements. "; pub fn args() -> clap::Command { clap::command!("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(()) }