From 9666eea62b8cf763027d1f01acbb403c1c6097e0 Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Wed, 31 Mar 2021 13:23:32 -0600 Subject: issuing correction on a previous post of mine, regarding pub(crate) --- src/args.rs | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'src/args.rs') diff --git a/src/args.rs b/src/args.rs index 134f785..4f36c03 100644 --- a/src/args.rs +++ b/src/args.rs @@ -8,11 +8,11 @@ use structopt::StructOpt; #[derive(StructOpt, Debug, PartialEq, Eq, Clone)] #[structopt(author, about)] #[allow(clippy::struct_excessive_bools)] -pub(crate) struct Args { +pub struct Args { /// Cause environment variables, including those with null values, to override macro /// assignments within makefiles. #[structopt(short, long)] - pub(crate) environment_overrides: bool, + pub environment_overrides: bool, /// Specify a different makefile (or '-' for standard input). /// @@ -28,14 +28,14 @@ pub(crate) struct Args { number_of_values = 1, parse(from_os_str) )] - pub(crate) makefile: Vec, + pub makefile: Vec, /// Ignore error codes returned by invoked commands. /// /// This mode is the same as if the special target .IGNORE were specified without /// prerequisites. #[structopt(short, long)] - pub(crate) ignore_errors: bool, + pub ignore_errors: bool, /// Continue to update other targets that do not depend on the current target if a /// non-ignored error occurs while executing the commands to bring a target @@ -46,7 +46,7 @@ pub(crate) struct Args { overrides_with = "keep-going", overrides_with = "no-keep-going" )] - pub(crate) keep_going: bool, + pub keep_going: bool, /// Write commands that would be executed on standard output, but do not execute them /// (but execute lines starting with '+'). @@ -60,14 +60,14 @@ pub(crate) struct Args { visible_alias = "just-print", visible_alias = "recon" )] - pub(crate) dry_run: bool, + pub dry_run: bool, /// Write to standard output the complete set of macro definitions and target /// descriptions. /// /// The output format is unspecified. #[structopt(short, long, visible_alias = "print-data-base")] - pub(crate) print_everything: bool, + pub print_everything: bool, /// Return a zero exit value if the target file is up-to-date; otherwise, return an /// exit value of 1. @@ -76,11 +76,11 @@ pub(crate) struct Args { /// command line (associated with the targets) with a ( '+' ) prefix /// shall be executed. #[structopt(short, long)] - pub(crate) question: bool, + pub question: bool, /// Clear the suffix list and do not use the built-in rules. #[structopt(short = "r", long)] - pub(crate) no_builtin_rules: bool, + pub no_builtin_rules: bool, /// Terminate make if an error occurs while executing the commands to bring a target /// up-to-date (default behavior, required by POSIX to be also a flag for some @@ -95,7 +95,7 @@ pub(crate) struct Args { overrides_with = "keep-going", overrides_with = "no-keep-going" )] - pub(crate) no_keep_going: bool, + pub no_keep_going: bool, /// Do not write makefile command lines or touch messages to standard output before /// executing. @@ -103,7 +103,7 @@ pub(crate) struct Args { /// This mode shall be the same as if the special target .SILENT were specified /// without prerequisites. #[structopt(short, long, visible_alias = "quiet")] - pub(crate) silent: bool, + pub silent: bool, /// Update the modification time of each target as though a touch target had been /// executed. @@ -114,14 +114,14 @@ pub(crate) struct Args { /// the makefile command lines associated with each target are not executed. However, /// a command line with a ( '+' ) prefix shall be executed. #[structopt(short, long)] - pub(crate) touch: bool, + pub touch: bool, /// Target names or macro definitions. /// /// If no target is specified, while make is processing the makefiles, the first /// target that make encounters that is not a special target or an inference rule /// shall be used. - pub(crate) targets_or_macros: Vec, + pub targets_or_macros: Vec, } impl Args { @@ -159,24 +159,24 @@ impl Args { Self::from_iter(args) } - pub(crate) fn from_env_and_args() -> Self { + pub fn from_env_and_args() -> Self { let env_makeflags = env::var("MAKEFLAGS").unwrap_or_default(); let args = env::args_os(); Self::from_given_args_and_given_env(args, env_makeflags) } #[cfg(test)] - pub(crate) fn empty() -> Self { + pub fn empty() -> Self { let env_makeflags = String::new(); let args = vec![OsString::from("makers")]; Self::from_given_args_and_given_env(args.into_iter(), env_makeflags) } - pub(crate) fn targets(&self) -> impl Iterator { + pub fn targets(&self) -> impl Iterator { self.targets_or_macros.iter().filter(|x| !x.contains('=')) } - pub(crate) fn macros(&self) -> impl Iterator { + pub fn macros(&self) -> impl Iterator { self.targets_or_macros.iter().filter(|x| x.contains('=')) } } -- cgit v1.2.3