use std::path::PathBuf;
use clap::{Parser, Subcommand};
#[derive(Parser, Debug)]
#[command(
name = "xzip",
version,
about = "ZIP tool with explicit filename encoding control",
long_about = "Pack and unpack ZIP archives with configurable filename encoding.\n\
Defaults to utf-8 when --encoding is omitted; use -e gbk (or cp936) \
for archives created on zh_CN Windows systems."
)]
pub struct Cli {
#[command(subcommand)]
pub command: Command,
}
#[derive(Subcommand, Debug)]
pub enum Command {
Pack {
#[arg(short = 'i', long)]
input: PathBuf,
#[arg(short = 'o', long)]
output: PathBuf,
#[arg(short = 'e', long, value_name = "ENCODING", default_value = "utf-8")]
encoding: String,
#[arg(short = 'r', long)]
recursive: bool,
#[arg(long = "include", value_name = "GLOB")]
include: Vec<String>,
#[arg(long = "exclude", value_name = "GLOB")]
exclude: Vec<String>,
},
Unpack {
#[arg(short = 'i', long)]
input: PathBuf,
#[arg(short = 'o', long)]
output: PathBuf,
#[arg(short = 'e', long, value_name = "ENCODING", default_value = "utf-8")]
encoding: String,
#[arg(long = "include", value_name = "GLOB")]
include: Vec<String>,
#[arg(long = "exclude", value_name = "GLOB")]
exclude: Vec<String>,
},
}