From 449a25bed1007901e0b2b14e1ca5573056235b01 Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Wed, 14 Apr 2021 00:35:21 -0600 Subject: only offer -C flag on full build --- src/args.rs | 15 +++++++++++++++ src/main.rs | 2 ++ 2 files changed, 17 insertions(+) diff --git a/src/args.rs b/src/args.rs index 9613dc3..6def229 100644 --- a/src/args.rs +++ b/src/args.rs @@ -117,6 +117,7 @@ pub struct Args { pub touch: bool, /// Change to the given directory before running. + #[cfg(feature = "full")] #[structopt(short = "C", long, parse(from_os_str))] pub directory: Option, @@ -213,6 +214,8 @@ mod test { no_keep_going: false, silent: false, touch: false, + #[cfg(feature = "full")] + directory: None, targets_or_macros: vec![], } ); @@ -239,6 +242,8 @@ mod test { no_keep_going: false, silent: true, touch: true, + #[cfg(feature = "full")] + directory: None, targets_or_macros: vec!["bar".into(), "baz=yeet".into()], } ); @@ -265,6 +270,8 @@ mod test { no_keep_going: false, silent: false, touch: false, + #[cfg(feature = "full")] + directory: None, targets_or_macros: vec![], } ); @@ -291,6 +298,8 @@ mod test { no_keep_going: true, silent: false, touch: false, + #[cfg(feature = "full")] + directory: None, targets_or_macros: vec![], } ); @@ -315,6 +324,8 @@ mod test { no_keep_going: false, silent: false, touch: false, + #[cfg(feature = "full")] + directory: None, targets_or_macros: vec![], } ); @@ -339,6 +350,8 @@ mod test { no_keep_going: false, silent: false, touch: false, + #[cfg(feature = "full")] + directory: None, targets_or_macros: vec![], } ); @@ -366,6 +379,8 @@ mod test { no_keep_going: true, silent: true, touch: true, + #[cfg(feature = "full")] + directory: None, targets_or_macros: vec!["foo=bar".into(), "bar".into(), "baz=yeet".into()], } ); diff --git a/src/main.rs b/src/main.rs index b43249d..e0deecc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,6 +20,7 @@ clippy::todo )] +#[cfg(feature = "full")] use std::env; use std::fs::metadata; use std::io::stdin; @@ -45,6 +46,7 @@ fn main() -> Result<()> { jane_eyre::install()?; let mut args = Args::from_env_and_args(); + #[cfg(feature = "full")] if let Some(dir) = args.directory.as_ref() { env::set_current_dir(dir)?; } -- cgit v1.2.3