diff options
Diffstat (limited to 'src/config.rs')
-rw-r--r-- | src/config.rs | 47 |
1 files changed, 43 insertions, 4 deletions
diff --git a/src/config.rs b/src/config.rs index 358a258..61a0778 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,20 +1,59 @@ +use std::path::PathBuf; + use clap::{Args, Parser}; use tracing::{metadata::LevelFilter, Level}; -use crate::search::Search; - -/// Tool for listing project directories. #[derive(Debug, Clone, Default, Parser)] #[command(author, version, about)] pub struct Config { + /// Directories to search. + /// + /// Directories are searched recursively based on `--max-depth`. + pub paths: Vec<PathBuf>, + + /// (UNIMPLEMENTED) Additional directories to add to the sorted output. + #[arg(long)] + pub add: Vec<PathBuf>, + #[command(flatten)] - pub search: Search, + pub filters: Filters, #[command(flatten)] pub verbosity: Verbosity, } #[derive(Debug, Default, Clone, Args)] +pub struct Filters { + /// Match all child directories. + #[arg(short, long)] + pub all: bool, + + /// Max depth to recurse. + /// + /// MAX_DEPTH of 0 will only return the supplied PATHS. + #[arg(short = 'd', long, default_value = "1")] + pub max_depth: Option<usize>, + + /// Recurse into hidden directories. + /// + /// Traverse into hidden directories while searching. A directory is considered hidden + /// if its name starts with a `.` sign (dot). If `--max-depth` is 0, this has no effect. + #[arg(long)] + pub hidden: bool, + + /// Match directories containing <PATTERN>. + /// + /// PATTERN should be a path relative to the searched directory. + #[arg(long, short)] + pub pattern: Option<String>, + + /// Match git repositories. + #[cfg(feature = "git")] + #[arg(long, short)] + pub git: bool, +} + +#[derive(Debug, Default, Clone, Args)] pub struct Verbosity { /// Print additional information per occurrence. /// |