2021-02-04 11:22:19 +00:00
|
|
|
use std::path::PathBuf;
|
2021-02-14 16:20:48 +00:00
|
|
|
|
|
|
|
use clap::Clap;
|
2021-02-10 09:20:22 +00:00
|
|
|
use smartstring::{LazyCompact, SmartString};
|
2021-02-18 11:43:24 +00:00
|
|
|
use crate::extensionset::ExtensionSet;
|
2021-02-10 09:20:22 +00:00
|
|
|
|
|
|
|
#[derive(Clap, PartialEq, Debug)]
|
|
|
|
pub enum OutputFormat {
|
|
|
|
Script,
|
2021-02-14 17:12:27 +00:00
|
|
|
Text,
|
2021-02-10 09:20:22 +00:00
|
|
|
}
|
2021-02-04 11:22:19 +00:00
|
|
|
|
2021-02-05 09:24:08 +00:00
|
|
|
#[derive(Clap, Debug)]
|
2021-02-04 11:22:19 +00:00
|
|
|
pub struct Parameters {
|
|
|
|
/// Only examine files with these extensions (Comma-separated list)
|
2021-02-18 11:43:24 +00:00
|
|
|
#[clap(short, long, use_delimiter = true, require_delimiter = true, required_unless_present = "ext-set")]
|
|
|
|
pub exts: Option<Vec<SmartString<LazyCompact>>>,
|
|
|
|
|
|
|
|
/// write good docs 0uo
|
|
|
|
#[clap(short = 'E', long, arg_enum, required_unless_present = "exts")]
|
|
|
|
pub ext_set: Option<ExtensionSet>,
|
2021-02-04 11:22:19 +00:00
|
|
|
|
|
|
|
/// Don't skip hidden files and directories
|
2021-02-05 09:24:08 +00:00
|
|
|
#[clap(short, long)]
|
2021-02-04 11:22:19 +00:00
|
|
|
pub scan_hidden: bool,
|
|
|
|
|
2021-02-06 03:24:13 +00:00
|
|
|
/// Output format to use. See "--help formats" for more information.
|
2021-02-14 17:12:27 +00:00
|
|
|
#[clap(short, long, default_value = "script", arg_enum)]
|
2021-02-10 09:20:22 +00:00
|
|
|
pub output_format: OutputFormat,
|
2021-02-06 03:24:13 +00:00
|
|
|
|
|
|
|
/// Directory to process
|
|
|
|
// TODO: right now this can only take a single directory - should this be improved?
|
|
|
|
#[clap(name = "DIR", default_value = ".", parse(from_os_str))]
|
2021-02-04 11:22:19 +00:00
|
|
|
pub dirs: PathBuf,
|
|
|
|
}
|