Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
| hg-reviewers |
| No Linters Available |
| No Unit Test Coverage |
| fn main() { | fn main() { | ||||
| let mut app = App::new("rhg") | let mut app = App::new("rhg") | ||||
| .setting(AppSettings::AllowInvalidUtf8) | .setting(AppSettings::AllowInvalidUtf8) | ||||
| .setting(AppSettings::SubcommandRequired) | .setting(AppSettings::SubcommandRequired) | ||||
| .setting(AppSettings::VersionlessSubcommands) | .setting(AppSettings::VersionlessSubcommands) | ||||
| .version("0.0.1") | .version("0.0.1") | ||||
| .subcommand( | .subcommand( | ||||
| SubCommand::with_name("root").about(commands::root::HELP_TEXT), | SubCommand::with_name("root").about(commands::root::HELP_TEXT), | ||||
| ) | |||||
| .subcommand( | |||||
| SubCommand::with_name("files").about(commands::files::HELP_TEXT), | |||||
| ); | ); | ||||
| let matches = app.clone().get_matches_safe().unwrap_or_else(|_| { | let matches = app.clone().get_matches_safe().unwrap_or_else(|_| { | ||||
| std::process::exit(exitcode::UNIMPLEMENTED_COMMAND) | std::process::exit(exitcode::UNIMPLEMENTED_COMMAND) | ||||
| }); | }); | ||||
| let ui = ui::Ui::new(); | let ui = ui::Ui::new(); | ||||
| let command_result = match matches.subcommand_name() { | let command_result = match matches.subcommand_name() { | ||||
| Some(name) => match name { | Some(name) => match name { | ||||
| "root" => commands::root::RootCommand::new(ui).run(), | "root" => commands::root::RootCommand::new(ui).run(), | ||||
| "files" => commands::files::FilesCommand::new(ui).run(), | |||||
| _ => std::process::exit(exitcode::UNIMPLEMENTED_COMMAND), | _ => std::process::exit(exitcode::UNIMPLEMENTED_COMMAND), | ||||
| }, | }, | ||||
| _ => { | _ => { | ||||
| match app.print_help() { | match app.print_help() { | ||||
| Ok(_) => std::process::exit(exitcode::OK), | Ok(_) => std::process::exit(exitcode::OK), | ||||
| Err(_) => std::process::exit(exitcode::ABORT), | Err(_) => std::process::exit(exitcode::ABORT), | ||||
| }; | }; | ||||
| } | } | ||||