use std::path::PathBuf;
use clap::Subcommand;
use nestify::nest;
nest! {
#[derive(clap::Args, Debug, Clone)]
pub struct ImportCommand {
#[command(subcommand)]
pub import_type: #[derive(Subcommand, Debug, Clone)] pub enum ImportType {
Postman(PostmanImport),
PostmanEnv(PostmanEnvImport),
Curl(CurlImport),
#[clap(alias = "openapi")]
OpenApi(OpenApiImport)
}
}
}
#[derive(clap::Args, Debug, Clone)]
pub struct PostmanImport {
#[clap(value_hint = clap::ValueHint::FilePath)]
pub import_path: PathBuf,
#[arg(long)]
pub max_depth: Option<u16>,
}
#[derive(clap::Args, Debug, Clone)]
pub struct PostmanEnvImport {
#[clap(value_hint = clap::ValueHint::FilePath)]
pub import_path: PathBuf,
#[clap(short, long, default_value_t = false)]
pub force_uppercase_keys: bool,
#[clap(short, long, default_value_t = false)]
pub use_disabled: bool,
}
#[derive(clap::Args, Debug, Clone)]
pub struct CurlImport {
#[clap(value_hint = clap::ValueHint::AnyPath)]
pub import_path: PathBuf,
pub collection_name: String,
pub request_name: Option<String>,
#[arg(short, long, conflicts_with = "request_name")]
pub recursive: bool,
#[arg(long, requires = "recursive", conflicts_with = "request_name")]
pub max_depth: Option<u16>,
}
#[derive(clap::Args, Debug, Clone)]
pub struct OpenApiImport {
#[clap(value_hint = clap::ValueHint::FilePath)]
pub import_path: PathBuf,
#[arg(long)]
pub max_depth: Option<u16>,
}