MCPcopy Create free account
hub / github.com/aws/amazon-q-developer-cli / main

Function main

crates/chat-cli/src/main.rs:28–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
27
28fn main() -> Result<ExitCode> {
29 color_eyre::install()?;
30
31 let parsed = match cli::Cli::try_parse() {
32 Ok(cli) => cli,
33 Err(err) => {
34 err.print().ok();
35 return Ok(ExitCode::from(err.exit_code().try_into().unwrap_or(2)));
36 },
37 };
38
39 let verbose = parsed.verbose > 0;
40 let runtime = tokio::runtime::Builder::new_multi_thread().enable_all().build()?;
41 let result = runtime.block_on(parsed.execute());
42
43 match result {
44 Ok(exit_code) => Ok(exit_code),
45 Err(err) => {
46 if verbose || get_log_level_max() > LevelFilter::INFO {
47 eprintln!("{} {err:?}", StyledText::error("error:"));
48 } else {
49 eprintln!("{} {err}", StyledText::error("error:"));
50 }
51
52 Ok(ExitCode::FAILURE)
53 },
54 }
55}

Callers

nothing calls this directly

Calls 5

get_log_level_maxFunction · 0.85
printMethod · 0.80
exit_codeMethod · 0.45
buildMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected