use std::path::PathBuf;
use clap::Parser;
use tracing::Level;
use crate::cli::commands::Commands;
use crate::cli::configs::{DiagnosticConfig, LoadingConfig};
const ABOUT_MESSAGE: &str =
"Typechecks or interprets passed INPUT using Kodept programming language";
#[derive(Parser, Debug, Clone)]
#[command(version, author, about = ABOUT_MESSAGE)]
#[command(propagate_version = true)]
pub struct Kodept {
#[arg(short, long)]
debug: bool,
#[arg(short, long, conflicts_with = "debug")]
verbose: bool,
#[arg(
short = 's',
long = "severity",
ignore_case = true,
default_value = "info",
env = "RUST_LOG",
conflicts_with_all = ["debug", "verbose"]
)]
verbosity: Level,
#[arg(short = 'o', long = "out", default_value = "./build")]
pub output: PathBuf,
#[command(flatten)]
pub diagnostic_config: DiagnosticConfig,
#[command(flatten)]
pub loading_config: LoadingConfig,
#[command(subcommand)]
pub subcommands: Commands,
}
impl Kodept {
pub fn level(&self) -> Level {
if self.debug {
Level::DEBUG
} else if self.verbose {
Level::TRACE
} else {
self.verbosity
}
}
}