MCPcopy Create free account
hub / github.com/apache/datafusion / run_cli

Function run_cli

benchmarks/src/benchmark_runner/mod.rs:54–83  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

52/// This discovers suite metadata, parses the help/list command, and dispatches
53/// to the selected implementation.
54pub fn run_cli<I, T>(args: I) -> Result<()>
55where
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(&registry)?)?;
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.

Callers 1

mainFunction · 0.85

Calls 7

default_benchmark_dirFunction · 0.85
build_cliFunction · 0.85
newFunction · 0.85
command_from_matchesFunction · 0.85
print_styledFunction · 0.85
format_suite_list_styledFunction · 0.85
kindMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…