summaryrefslogtreecommitdiffstats
path: root/src/config.rs
diff options
context:
space:
mode:
authorToby Vincent <tobyv13@gmail.com>2023-04-28 17:32:24 -0500
committerToby Vincent <tobyv13@gmail.com>2023-04-28 17:32:24 -0500
commit589cd987217755e1da7acbc304c373a75a9f7db5 (patch)
tree2730a697e4f7b2f779fcd96b0452719cc67f36e3 /src/config.rs
parenta98b50667bc6a11e4b8be464969adc14601e9e78 (diff)
refactor: simplify logic and clean up dep.
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs47
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.
///