Private
Public Access
1
0
Files
Kordophone/kpcli/src/main.rs

36 lines
764 B
Rust
Raw Normal View History

mod printers;
2024-12-08 15:08:15 -08:00
mod client;
2024-11-09 17:35:39 -08:00
use clap::{Parser, Subcommand};
/// A command line interface for the Kordophone library and daemon
2024-11-09 17:35:39 -08:00
#[derive(Parser)]
#[command(name = "kpcli")]
struct Cli {
#[command(subcommand)]
command: Commands,
}
#[derive(Subcommand)]
enum Commands {
/// Commands for api client operations
Client {
#[command(subcommand)]
2024-12-08 15:08:15 -08:00
command: client::Commands,
2024-11-09 17:35:39 -08:00
},
}
async fn run_command(command: Commands) -> Result<(), Box<dyn std::error::Error>> {
match command {
2024-12-08 15:08:15 -08:00
Commands::Client { command } => client::Commands::run(command).await,
2024-11-09 17:35:39 -08:00
}
}
#[tokio::main]
async fn main() {
let cli = Cli::parse();
run_command(cli.command).await
.map_err(|e| log::error!("Error: {}", e))
.err();
}