use clap::{Args, Subcommand, ValueEnum};
use std::path::PathBuf;
#[derive(Args, Debug)]
pub struct EncodeArgs {
pub dictionary: String,
pub file: Option<PathBuf>,
#[arg(short = 'c', long, value_name = "ALG")]
pub compress: Option<Option<String>>,
#[arg(long)]
pub level: Option<u32>,
#[arg(long, value_name = "ALG")]
pub hash: Option<String>,
#[arg(long)]
pub xxhash_seed: Option<u64>,
#[arg(long)]
pub xxhash_secret_stdin: bool,
#[arg(short = 'o', long)]
pub output: Option<PathBuf>,
#[arg(short = 's', long)]
pub stream: bool,
}
#[derive(Args, Debug)]
pub struct DecodeArgs {
pub dictionary: String,
pub file: Option<PathBuf>,
#[arg(long, value_name = "ALG")]
pub decompress: Option<String>,
#[arg(long, value_name = "ALG")]
pub hash: Option<String>,
#[arg(long)]
pub xxhash_seed: Option<u64>,
#[arg(long)]
pub xxhash_secret_stdin: bool,
#[arg(short = 'o', long)]
pub output: Option<PathBuf>,
#[arg(short = 's', long)]
pub stream: bool,
}
#[derive(Args, Debug)]
pub struct DetectArgs {
pub file: Option<PathBuf>,
#[arg(long, value_name = "N")]
pub show_candidates: Option<usize>,
#[arg(long)]
pub decompress: Option<String>,
}
#[derive(Args, Debug)]
pub struct HashArgs {
pub algorithm: String,
pub file: Option<PathBuf>,
#[arg(long)]
pub seed: Option<u64>,
#[arg(long, value_name = "DICT")]
pub encode: Option<String>,
#[arg(long)]
pub secret_stdin: bool,
}
#[derive(Args, Debug)]
pub struct NeoArgs {
#[arg(long, value_name = "DICT")]
pub dictionary: Option<String>,
#[arg(long)]
pub dejavu: bool,
#[arg(long)]
pub cycle: bool,
#[arg(long)]
pub random: bool,
#[arg(long, value_name = "INTERVAL")]
pub interval: Option<String>,
#[arg(long)]
pub superman: bool,
}
#[derive(Args, Debug)]
pub struct SchemaArgs {
pub file: Option<PathBuf>,
#[arg(short = 'd', long)]
pub decode: bool,
#[arg(short = 'p', long)]
pub pretty: bool,
#[arg(short = 'c', long, value_enum)]
pub compress: Option<SchemaCompressionAlgoCli>,
#[arg(short = 'o', long)]
pub output: Option<PathBuf>,
}
#[derive(Clone, Copy, Debug, ValueEnum)]
pub enum SchemaCompressionAlgoCli {
Brotli,
Lz4,
Zstd,
}
impl From<SchemaCompressionAlgoCli> for base_d::SchemaCompressionAlgo {
fn from(cli: SchemaCompressionAlgoCli) -> Self {
match cli {
SchemaCompressionAlgoCli::Brotli => base_d::SchemaCompressionAlgo::Brotli,
SchemaCompressionAlgoCli::Lz4 => base_d::SchemaCompressionAlgo::Lz4,
SchemaCompressionAlgoCli::Zstd => base_d::SchemaCompressionAlgo::Zstd,
}
}
}
#[derive(Subcommand, Debug)]
pub enum ConfigAction {
List {
#[arg(value_name = "TYPE")]
category: Option<ConfigCategory>,
#[arg(long)]
json: bool,
},
Show {
dictionary: String,
},
}
#[derive(Clone, ValueEnum, Debug)]
pub enum ConfigCategory {
Dictionaries,
Algorithms,
Hashes,
}
#[derive(Debug, Clone, Copy, Default, ValueEnum)]
pub enum SteleMode {
#[default]
Auto,
None,
Light,
Full,
Path,
Ascii,
Markdown,
}
#[derive(Args, Debug)]
pub struct SteleArgs {
#[command(subcommand)]
pub command: Option<SteleCommand>,
#[arg(short, long)]
pub mode: Option<SteleMode>,
#[arg(short, long)]
pub output: Option<PathBuf>,
pub input: Option<String>,
#[arg(long)]
pub multiline: bool,
#[arg(long)]
pub markdown: bool,
}
#[derive(Subcommand, Debug)]
pub enum SteleCommand {
Encode(SteleEncodeArgs),
Decode(SteleDecodeArgs),
}
#[derive(Args, Debug)]
pub struct SteleEncodeArgs {
#[arg(short, long, default_value = "auto")]
pub mode: SteleMode,
#[arg(short, long)]
pub output: Option<PathBuf>,
pub input: Option<String>,
#[arg(long)]
pub multiline: bool,
#[arg(long)]
pub markdown: bool,
}
#[derive(Args, Debug)]
pub struct SteleDecodeArgs {
#[arg(short, long)]
pub pretty: bool,
#[arg(short, long)]
pub output: Option<PathBuf>,
pub input: Option<String>,
}