1use anyhow::Result;
5use clap::Parser;
6use tracing_subscriber::{EnvFilter, fmt};
7
8mod cmd;
9
10#[derive(Debug, Parser)]
12#[command(
13 name = "openlogi",
14 version,
15 about = "OpenLogi: a local-first companion for Logitech HID++ peripherals.",
16 long_about = None,
17)]
18struct Cli {
19 #[command(subcommand)]
20 cmd: Option<cmd::Command>,
21}
22
23pub async fn run() -> Result<()> {
25 fmt()
26 .with_writer(std::io::stderr)
27 .with_env_filter(
28 EnvFilter::try_from_env("OPENLOGI_LOG").unwrap_or_else(|_| EnvFilter::new("info")),
29 )
30 .init();
31
32 let cli = Cli::parse();
33 let command = cli
34 .cmd
35 .unwrap_or(cmd::Command::List(cmd::list::ListArgs {}));
36 command.run().await
37}