use std::path::PathBuf;
use clap::Parser;
use dodo_bindgen_codegen::CodegenOpts;
#[derive(Debug, Parser)]
#[command(
name = "deno-bindgen2",
version,
about = "A Rust FFI bindings generator for Deno. Use this CLI tool with the `deno_bindgen2` library crate",
long_about = None
)]
pub struct Cli {
#[arg(short = 'o', long, value_hint = clap::ValueHint::FilePath)]
pub output: Option<PathBuf>,
#[arg(short = 'p', long, default_value = "release", conflicts_with = "debug")]
pub profile: String,
#[arg(short = 'd', long)]
pub debug: bool,
#[arg(short = 't', long = "target")]
pub targets: Vec<String>,
#[arg(short = 'l', long)]
lazy: bool,
#[arg(short = 'i', long)]
pub inline: bool,
#[arg(short = 'N', long)]
no_modules: bool,
}
impl Cli {
pub fn profile(&self) -> &str {
if self.debug { "dev" } else { &self.profile }
}
pub fn to_codegen_opts(&self, file_name: String, lib_name: String) -> CodegenOpts {
CodegenOpts {
file_name,
lib_name,
lazy: self.lazy,
}
}
}