aboutsummaryrefslogtreecommitdiff
path: root/src/args.rs
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2021-03-31 13:23:32 -0600
committerMelody Horn <melody@boringcactus.com>2021-03-31 13:23:32 -0600
commit9666eea62b8cf763027d1f01acbb403c1c6097e0 (patch)
treefb7f825089323ac8ef19203e7ff80f41156ce01b /src/args.rs
parent9d3e0824a0966c648e951e5928c241700ee931fb (diff)
downloadmakers-9666eea62b8cf763027d1f01acbb403c1c6097e0.tar.gz
makers-9666eea62b8cf763027d1f01acbb403c1c6097e0.zip
issuing correction on a previous post of mine, regarding pub(crate)
Diffstat (limited to 'src/args.rs')
-rw-r--r--src/args.rs34
1 files changed, 17 insertions, 17 deletions
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<PathBuf>,
+ pub makefile: Vec<PathBuf>,
/// 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 <plus-sign> ( '+' ) 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 <plus-sign> ( '+' ) 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<String>,
+ pub targets_or_macros: Vec<String>,
}
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<Item = &String> {
+ pub fn targets(&self) -> impl Iterator<Item = &String> {
self.targets_or_macros.iter().filter(|x| !x.contains('='))
}
- pub(crate) fn macros(&self) -> impl Iterator<Item = &String> {
+ pub fn macros(&self) -> impl Iterator<Item = &String> {
self.targets_or_macros.iter().filter(|x| x.contains('='))
}
}