use std::path::PathBuf;
use clap::arg_enum;
use structopt::StructOpt;
arg_enum! {
#[allow(non_camel_case_types)]
pub enum OutputFormat {
text,
json
}
}
#[derive(StructOpt)]
#[structopt(name = "askalono")]
pub struct Opt {
#[structopt(long = "cache", short = "c", parse(from_os_str))]
pub cache: Option<PathBuf>,
#[structopt(long = "format")]
#[structopt(raw(possible_values = "&OutputFormat::variants()"))]
pub format: Option<OutputFormat>,
#[structopt(subcommand)]
pub subcommand: Subcommand,
}
#[derive(StructOpt)]
pub enum Subcommand {
#[structopt(name = "identify", alias = "id")]
Identify {
#[structopt(name = "FILE", required_unless = "batch", parse(from_os_str))]
filename: Option<PathBuf>,
#[structopt(long = "optimize", short = "o")]
optimize: bool,
#[structopt(raw(hidden = "true"))]
#[structopt(long = "diff")]
diff: bool,
#[structopt(long = "batch", short = "b")]
batch: bool,
},
#[structopt(name = "crawl")]
Crawl {
#[structopt(name = "DIR", parse(from_os_str))]
directory: PathBuf,
#[structopt(long = "follow")]
follow_links: bool,
#[structopt(long = "glob")]
glob: Option<String>,
},
#[structopt(name = "cache")]
Cache {
#[structopt(subcommand)]
subcommand: CacheSubcommand,
},
}
#[derive(StructOpt)]
pub enum CacheSubcommand {
#[structopt(name = "load-spdx")]
LoadSpdx {
#[structopt(name = "DIR", parse(from_os_str))]
dir: PathBuf,
#[structopt(long = "store")]
store_texts: bool,
},
}