##// END OF EJS Templates
rhg: print error message when argument parsing fails...
Antoine Cezar -
r46011:a6a000ab default
parent child Browse files
Show More
@@ -21,7 +21,8 b' fn main() {'
21 21 SubCommand::with_name("files").about(commands::files::HELP_TEXT),
22 22 );
23 23
24 let matches = app.clone().get_matches_safe().unwrap_or_else(|_| {
24 let matches = app.clone().get_matches_safe().unwrap_or_else(|err| {
25 let _ = ui::Ui::new().writeln_stderr_str(&err.message);
25 26 std::process::exit(exitcode::UNIMPLEMENTED_COMMAND)
26 27 });
27 28
@@ -47,6 +47,11 b' impl Ui {'
47 47
48 48 stderr.flush().or_else(handle_stderr_error)
49 49 }
50
51 /// Write string line to stderr
52 pub fn writeln_stderr_str(&self, s: &str) -> Result<(), UiError> {
53 self.write_stderr(&format!("{}\n", s).as_bytes())
54 }
50 55 }
51 56
52 57 /// A buffered stdout writer for faster batch printing operations.
@@ -12,6 +12,12 b' Define an rhg function that will only ru'
12 12
13 13 Unimplemented command
14 14 $ rhg unimplemented-command
15 error: Found argument 'unimplemented-command' which wasn't expected, or isn't valid in this context
16
17 USAGE:
18 rhg <SUBCOMMAND>
19
20 For more information try --help
15 21 [252]
16 22
17 23 Finding root
General Comments 0
You need to be logged in to leave comments. Login now