diff options
author | Toby Vincent <tobyv13@gmail.com> | 2022-11-26 16:43:14 -0600 |
---|---|---|
committer | Toby Vincent <tobyv13@gmail.com> | 2022-11-26 16:43:14 -0600 |
commit | 46cee052d6d4b60b483ab6841af976d68d954705 (patch) | |
tree | 19bbe2170c5a2e6af3b306e14c942ccd1393228a /src/cli.rs | |
parent | 0f428974b2d7f4cf59490904564e52d134b9ef3a (diff) |
feat: add project filtering
Diffstat (limited to 'src/cli.rs')
-rw-r--r-- | src/cli.rs | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -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(); |