diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/args.rs | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/src/args.rs b/src/args.rs index f0892cb..40f591f 100644 --- a/src/args.rs +++ b/src/args.rs @@ -242,7 +242,6 @@ impl Args { if self.touch { flags.push('t'); } - // TODO decide whether or not print_directory should go here too let macros = self .targets_or_macros @@ -257,9 +256,18 @@ impl Args { result.push('-'); } result.add_assign(&flags); + + #[cfg(feature = "full")] + if self.no_print_directory { + if !result.is_empty() { + result.push(' '); + } + result.push_str("--no-print-directory"); + } + // TODO consider -- to separate flags from macros - GNU does it but it would require // gnarly splicing to not override recursive macros - if !flags.is_empty() && !macros.is_empty() { + if !result.is_empty() && !macros.is_empty() { result += " "; } result.add_assign(¯os); @@ -528,4 +536,28 @@ mod test { ); assert_eq!(args.makeflags(), "-einpqrSst -- baz=yeet foo=bar"); } + + #[cfg(feature = "full")] + #[test] + fn makeflags_no_print_directory() { + let args = + Args { + environment_overrides: false, + makefile: vec![], + ignore_errors: false, + keep_going: false, + dry_run: false, + print_everything: false, + question: false, + no_builtin_rules: false, + no_keep_going: false, + silent: false, + touch: false, + directory: None, + print_directory: false, + no_print_directory: true, + targets_or_macros: vec!["V=1".into()], + }; + assert_eq!(args.makeflags(), "--no-print-directory V=1"); + } } |