use std::path::PathBuf;
#[derive(Debug, Clone, Copy, clap::ValueEnum)]
#[non_exhaustive]
pub enum AvailableLanguage {
Kotlin,
Scala,
Swift,
Typescript,
#[cfg(feature = "go")]
Go,
#[cfg(feature = "python")]
Python,
}
#[derive(clap::Parser)]
#[command(
version,
args_conflicts_with_subcommands = true,
subcommand_negates_reqs = true,
name = "typeshare"
)]
pub struct Args {
#[command(subcommand)]
pub subcommand: Option<Command>,
#[arg(short, long = "lang", required_unless_present = "generate_config")]
pub language: Option<AvailableLanguage>,
#[arg(short, long)]
pub swift_prefix: Option<String>,
#[arg(short, long)]
pub kotlin_prefix: Option<String>,
#[arg(short, long)]
pub java_package: Option<String>,
#[arg(short = 'm', long = "module-name")]
pub kotlin_module_name: Option<String>,
#[arg(long)]
pub scala_package: Option<String>,
#[arg(long)]
pub scala_module_name: Option<String>,
#[cfg(feature = "go")]
#[arg(long)]
pub go_package: Option<String>,
#[arg(short, long)]
pub config_file: Option<PathBuf>,
#[command(flatten)]
pub output: Output,
#[arg(short = 'L', long)]
pub follow_links: bool,
#[arg(required=true, num_args = 1..)]
pub directories: Vec<PathBuf>,
#[arg(short, long, num_args = 1..)]
pub target_os: Option<Vec<String>>,
}
#[derive(Debug, Clone, Copy, clap::Subcommand)]
pub enum Command {
Completions {
shell: clap_complete::Shell,
},
}
#[derive(clap::Args, Debug)]
#[group(multiple = false, required = true)]
pub struct Output {
#[arg(short = 'o', long = "output-file")]
pub file: Option<PathBuf>,
#[arg(short = 'd', long = "output-folder")]
pub folder: Option<PathBuf>,
#[arg(short, long)]
pub generate_config: bool,
}