30 lines
581 B
Rust
30 lines
581 B
Rust
|
use anyhow::Context;
|
||
|
use clap::{Parser, Subcommand};
|
||
|
|
||
|
#[derive(Parser)]
|
||
|
#[command(author, version, about, long_about = None, subcommand_required = true)]
|
||
|
struct Command {
|
||
|
#[command(subcommand)]
|
||
|
command: Option<Commands>,
|
||
|
}
|
||
|
|
||
|
#[derive(Subcommand)]
|
||
|
enum Commands {
|
||
|
Hello {},
|
||
|
}
|
||
|
|
||
|
#[tokio::main]
|
||
|
async fn main() -> anyhow::Result<()> {
|
||
|
dotenv::dotenv().ok();
|
||
|
tracing_subscriber::fmt::init();
|
||
|
|
||
|
let cli = Command::parse();
|
||
|
tracing::debug!("Starting cli");
|
||
|
|
||
|
if let Some(Commands::Hello { }) = cli.command {
|
||
|
println!("Hello!")
|
||
|
}
|
||
|
|
||
|
Ok(())
|
||
|
}
|