use std::path::PathBuf;
use clap::{Parser, Subcommand};
#[tokio::main]
async fn main() -> std::io::Result<()> {
let cli = Cli::parse();
let default_level = if cli.troubles { "debug" } else { "info" };
tracing_subscriber::fmt()
.with_env_filter(
tracing_subscriber::EnvFilter::try_from_default_env()
.unwrap_or_else(|_| tracing_subscriber::EnvFilter::new(default_level)),
)
.without_time()
.init();
match cli.command {
Commands::Init => aer::tool::init().await,
Commands::Palette => aer::tool::palette::run(),
Commands::Procs {
procs_file,
profile,
} => aer::tool::procs::run(procs_file.as_deref(), profile.as_deref()).await,
Commands::Serve { port, profile } => aer::tool::serve::run(port, profile.as_deref()).await,
}
}
#[derive(Parser)]
#[command(name = "aer")]
#[command(about = "A command-line toolkit for creatives", long_about = None)]
struct Cli {
#[arg(long, global = true)]
troubles: bool,
#[command(subcommand)]
command: Commands,
}
#[derive(Subcommand)]
enum Commands {
Init,
Palette,
Procs {
procs_file: Option<PathBuf>,
#[arg(short, long)]
profile: Option<String>,
},
Serve {
#[arg(long, default_value = "1337")]
port: u16,
#[arg(short, long)]
profile: Option<String>,
},
}