Mercurial > public > mercurial-scm > hg-stable
view rust/rhg/src/commands/debugrequirements.rs @ 46557:a25033eb43b5
rhg: add limited support for the `config` sub-command
Only with one argument and no flag. This is mostly for testing.
Differential Revision: https://phab.mercurial-scm.org/D9972
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Mon, 08 Feb 2021 23:41:58 +0100 |
parents | d8730ff51d5a |
children | 80840b651721 |
line wrap: on
line source
use crate::error::CommandError; use crate::ui::Ui; use clap::ArgMatches; use hg::config::Config; use hg::repo::Repo; use std::path::Path; 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( ui: &Ui, config: &Config, repo_path: Option<&Path>, _args: &ArgMatches, ) -> Result<(), CommandError> { let repo = Repo::find(config, repo_path)?; 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'); } ui.write_stdout(output.as_bytes())?; Ok(()) }