summaryrefslogtreecommitdiffstats
path: root/src/cli.rs
diff options
context:
space:
mode:
authorToby Vincent <tobyv13@gmail.com>2022-11-26 16:43:14 -0600
committerToby Vincent <tobyv13@gmail.com>2022-11-26 16:43:14 -0600
commit46cee052d6d4b60b483ab6841af976d68d954705 (patch)
tree19bbe2170c5a2e6af3b306e14c942ccd1393228a /src/cli.rs
parent0f428974b2d7f4cf59490904564e52d134b9ef3a (diff)
feat: add project filtering
Diffstat (limited to 'src/cli.rs')
-rw-r--r--src/cli.rs18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/cli.rs b/src/cli.rs
index a30bb7f..666a223 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -1,4 +1,4 @@
-use crate::{Config, SearchPath};
+use crate::{search, Config};
use clap::{Args, Parser};
use figment::{value, Metadata, Profile, Provider};
use serde::{Deserialize, Serialize};
@@ -34,8 +34,16 @@ pub struct Projects {
///
/// 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, default_value_t)]
+ #[arg(long)]
hidden: bool,
+
+ /// Match git repositories
+ #[arg(long, short)]
+ git: bool,
+
+ /// Match directories containing item named <PATTERN>
+ #[arg(long, short)]
+ pattern: Option<String>,
}
impl Provider for Projects {
@@ -54,10 +62,12 @@ impl From<Projects> for Config {
.paths
.iter()
.cloned()
- .map(|p| SearchPath {
- path: p,
+ .map(|path_buf| search::entry::Config {
+ path_buf,
hidden: value.hidden,
max_depth: value.max_depth,
+ git: value.git,
+ pattern: value.pattern.to_owned(),
})
.collect();