diff options
-rw-r--r-- | src/cli.rs | 13 | ||||
-rw-r--r-- | src/search/entry/config.rs | 16 |
2 files changed, 20 insertions, 9 deletions
@@ -38,13 +38,14 @@ pub struct Projects { #[arg(long)] hidden: bool, - /// Match git repositories - #[arg(long, short, default_value_t = true)] - git: bool, - /// Match directories containing item named <PATTERN> #[arg(long, short)] pattern: Option<String>, + + /// Match git repositories + #[cfg(feature = "git")] + #[arg(long, short, default_value_t = true)] + git: bool, } impl Provider for Projects { @@ -67,8 +68,10 @@ impl From<Projects> for Config { path_buf, hidden: value.hidden, max_depth: value.max_depth, - git: value.git, pattern: value.pattern.to_owned(), + + #[cfg(feature = "git")] + git: value.git, }) .collect(); diff --git a/src/search/entry/config.rs b/src/search/entry/config.rs index 24c7971..4372356 100644 --- a/src/search/entry/config.rs +++ b/src/search/entry/config.rs @@ -7,8 +7,10 @@ pub struct Config { pub path_buf: PathBuf, pub hidden: bool, pub max_depth: Option<usize>, - pub git: bool, pub pattern: Option<String>, + + #[cfg(feature = "git")] + pub git: bool, } impl From<PathBuf> for Config { @@ -51,8 +53,10 @@ impl<'de> Deserialize<'de> for Config { path_buf: PathBuf, hidden: bool, max_depth: Option<usize>, - git: bool, pattern: Option<String>, + + #[cfg(feature = "git")] + git: bool, }, } @@ -62,14 +66,18 @@ impl<'de> Deserialize<'de> for Config { path_buf, hidden, max_depth, - git, pattern, + + #[cfg(feature = "git")] + git, } => Ok(Self { path_buf, hidden, max_depth, - git, pattern, + + #[cfg(feature = "git")] + git, }), } } |