mod client; mod db; mod printers; use anyhow::Result; use clap::{Parser, Subcommand}; /// A command line interface for the Kordophone library and daemon #[derive(Parser)] #[command(name = "kpcli")] struct Cli { #[command(subcommand)] command: Commands, } #[derive(Subcommand)] enum Commands { /// Commands for api client operations Client { #[command(subcommand)] command: client::Commands, }, /// Commands for the cache database Db { #[command(subcommand)] command: db::Commands, } } async fn run_command(command: Commands) -> Result<()> { match command { Commands::Client { command } => client::Commands::run(command).await, Commands::Db { command } => db::Commands::run(command).await, } } #[tokio::main] async fn main() { let cli = Cli::parse(); run_command(cli.command).await .map_err(|e| log::error!("Error: {}", e)) .err(); }