##// END OF EJS Templates
tests: avoid "magic" nodeids in test-rebase-legacy.t...
tests: avoid "magic" nodeids in test-rebase-legacy.t This helps with readability. Differential Revision: https://phab.mercurial-scm.org/D8735

File last commit:

r45571:3707f6e7 default
r45670:503d0dd2 default
Show More
main.rs
42 lines | 1.1 KiB | application/rls-services+xml | RustLexer
Antoine Cezar
rhg: add a limited `rhg root` subcommand...
r45593 use clap::App;
use clap::AppSettings;
use clap::SubCommand;
Antoine Cezar
rhg: add Command trait for subcommands implemented by rhg...
r45515 mod commands;
mod error;
Antoine Cezar
rhg: add rhg crate...
r45503 mod exitcode;
Antoine Cezar
rhg: add RootCommand using hg-core FindRoot operation to prepare `hg root`...
r45592 mod ui;
Antoine Cezar
rhg: add a limited `rhg root` subcommand...
r45593 use commands::Command;
Antoine Cezar
rhg: add rhg crate...
r45503
fn main() {
Antoine Cezar
rhg: add a limited `rhg root` subcommand...
r45593 let mut app = App::new("rhg")
.setting(AppSettings::AllowInvalidUtf8)
.setting(AppSettings::SubcommandRequired)
.setting(AppSettings::VersionlessSubcommands)
.version("0.0.1")
.subcommand(
SubCommand::with_name("root").about(commands::root::HELP_TEXT),
);
let matches = app.clone().get_matches_safe().unwrap_or_else(|_| {
std::process::exit(exitcode::UNIMPLEMENTED_COMMAND)
});
let command_result = match matches.subcommand_name() {
Some(name) => match name {
"root" => commands::root::RootCommand::new().run(),
_ => std::process::exit(exitcode::UNIMPLEMENTED_COMMAND),
},
_ => {
match app.print_help() {
Ok(_) => std::process::exit(exitcode::OK),
Err(_) => std::process::exit(exitcode::ABORT),
};
}
};
match command_result {
Ok(_) => std::process::exit(exitcode::OK),
Err(e) => e.exit(),
}
Antoine Cezar
rhg: add rhg crate...
r45503 }