##// END OF EJS Templates
rhg: replace command structs with functions...
rhg: replace command structs with functions The `Command` trait was not used in any generic context, and the struct where nothing more than holders for values parsed from CLI arguments to be available to a `run` method. Differential Revision: https://phab.mercurial-scm.org/D9967

File last commit:

r47228:b1921234 default
r47228:b1921234 default
Show More
debugrequirements.rs
26 lines | 608 B | application/rls-services+xml | RustLexer
/ rust / rhg / src / commands / debugrequirements.rs
use crate::error::CommandError;
use crate::ui::Ui;
use clap::ArgMatches;
use hg::config::Config;
use hg::repo::Repo;
pub const HELP_TEXT: &str = "
Print the current repo requirements.
";
pub fn run(
ui: &Ui,
config: &Config,
_args: &ArgMatches,
) -> Result<(), CommandError> {
let repo = Repo::find(config)?;
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(())
}