1use crate::cli::{actions::Action, commands, dispatch, telemetry};
2use anyhow::Result;
3
4const fn get_verbosity_level(verbose_count: u8) -> Option<tracing::Level> {
6 match verbose_count {
7 0 => None,
8 1 => Some(tracing::Level::INFO),
9 2 => Some(tracing::Level::DEBUG),
10 _ => Some(tracing::Level::TRACE),
11 }
12}
13
14pub fn start() -> Result<Action> {
20 let matches = commands::new().get_matches();
22
23 let verbosity_level = get_verbosity_level(matches.get_count("verbose"));
25
26 telemetry::init(verbosity_level)?;
28
29 let action = dispatch::handler(&matches)?;
31
32 Ok(action)
34}