use std::path::PathBuf; use clap::{Parser, Subcommand}; use color_eyre::Result; use tracing_error::ErrorLayer; use tracing_subscriber::fmt; use tracing_subscriber::prelude::*; use tracing_subscriber::EnvFilter; #[derive(Debug, Parser)] #[command(author, version, about, long_about = None)] #[command(propagate_version = true)] struct Cli { #[command(subcommand)] command: Commands, } #[derive(Clone, Debug, Subcommand)] enum Commands { Pr { #[command(subcommand)] action: Action, }, } #[derive(Clone, Debug, Subcommand)] pub(crate) enum Action { Check, In { dest: PathBuf }, Out, } mod types; mod cmd { pub mod pr; } // #[tracing::instrument] fn main() -> Result<()> { let filter_layer = EnvFilter::try_from_default_env() .or_else(|_| EnvFilter::try_new("info")) .unwrap(); tracing_subscriber::registry() .with(filter_layer) .with(ErrorLayer::new(fmt::format::Pretty::default())) .init(); let cli = Cli::parse(); match &cli.command { Commands::Pr { action } => cmd::pr::run(action), } }