Runs the benchmark runner command-line flow for the provided argument list. This discovers suite metadata, parses the help/list command, and dispatches to the selected implementation.
(args: I)
| 52 | /// This discovers suite metadata, parses the help/list command, and dispatches |
| 53 | /// to the selected implementation. |
| 54 | pub fn run_cli<I, T>(args: I) -> Result<()> |
| 55 | where |
| 56 | I: IntoIterator<Item = T>, |
| 57 | T: Clone + Into<std::ffi::OsString>, |
| 58 | { |
| 59 | let benchmark_dir = default_benchmark_dir(); |
| 60 | let registry = SuiteRegistry::discover(&benchmark_dir)?; |
| 61 | let mut cli = build_cli(); |
| 62 | let matches = match cli.try_get_matches_from_mut(args) { |
| 63 | Ok(matches) => matches, |
| 64 | Err(e) if e.kind() == clap::error::ErrorKind::DisplayHelp => { |
| 65 | e.print()?; |
| 66 | return Ok(()); |
| 67 | } |
| 68 | Err(e) => return Err(DataFusionError::External(Box::new(e))), |
| 69 | }; |
| 70 | let command = command_from_matches(&matches)?; |
| 71 | |
| 72 | match command { |
| 73 | RunnerCommand::Help => { |
| 74 | cli.print_long_help()?; |
| 75 | println!(); |
| 76 | } |
| 77 | RunnerCommand::List => { |
| 78 | print_styled(&format_suite_list_styled(®istry)?)?; |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | Ok(()) |
| 83 | } |
| 84 | |
| 85 | /// Writes already styled output through `anstream` so ANSI color handling |
| 86 | /// matches clap help output on supported terminals. |
no test coverage detected
searching dependent graphs…