aboutsummaryrefslogtreecommitdiff
path: root/src/args.rs
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2021-03-27 17:02:11 -0600
committerMelody Horn <melody@boringcactus.com>2021-03-27 17:02:11 -0600
commit86c271eb2f9c0b3e1e2a35d26a2dca37435b5b8c (patch)
tree5adc564056cf349793f4b9ffd6c70bf908117cc1 /src/args.rs
parent5197d769bb2fea50975122a4ebba89c07c712839 (diff)
downloadmakers-86c271eb2f9c0b3e1e2a35d26a2dca37435b5b8c.tar.gz
makers-86c271eb2f9c0b3e1e2a35d26a2dca37435b5b8c.zip
why `pub` when you can `pub(crate)`?
Diffstat (limited to 'src/args.rs')
-rw-r--r--src/args.rs32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/args.rs b/src/args.rs
index efc0f11..ae58ce2 100644
--- a/src/args.rs
+++ b/src/args.rs
@@ -7,11 +7,11 @@ use structopt::StructOpt;
#[derive(StructOpt, Debug, PartialEq, Eq, Clone)]
#[structopt(author, about)]
-pub struct Args {
+pub(crate) struct Args {
/// Cause environment variables, including those with null values, to override macro
/// assignments within makefiles.
#[structopt(short, long)]
- pub environment_overrides: bool,
+ pub(crate) environment_overrides: bool,
/// Specify a different makefile (or '-' for standard input).
///
@@ -27,14 +27,14 @@ pub struct Args {
number_of_values = 1,
parse(from_os_str)
)]
- pub makefile: Vec<PathBuf>,
+ pub(crate) 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 ignore_errors: bool,
+ pub(crate) 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
@@ -45,7 +45,7 @@ pub struct Args {
overrides_with = "keep-going",
overrides_with = "no-keep-going"
)]
- pub keep_going: bool,
+ pub(crate) keep_going: bool,
/// Write commands that would be executed on standard output, but do not execute them
/// (but execute lines starting with '+').
@@ -59,14 +59,14 @@ pub struct Args {
visible_alias = "just-print",
visible_alias = "recon"
)]
- pub dry_run: bool,
+ pub(crate) 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 print_everything: bool,
+ pub(crate) print_everything: bool,
/// Return a zero exit value if the target file is up-to-date; otherwise, return an
/// exit value of 1.
@@ -75,11 +75,11 @@ pub struct Args {
/// command line (associated with the targets) with a <plus-sign> ( '+' ) prefix
/// shall be executed.
#[structopt(short, long)]
- pub question: bool,
+ pub(crate) question: bool,
/// Clear the suffix list and do not use the built-in rules.
#[structopt(short = "r", long)]
- pub no_builtin_rules: bool,
+ pub(crate) 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
@@ -94,7 +94,7 @@ pub struct Args {
overrides_with = "keep-going",
overrides_with = "no-keep-going"
)]
- pub no_keep_going: bool,
+ pub(crate) no_keep_going: bool,
/// Do not write makefile command lines or touch messages to standard output before
/// executing.
@@ -102,7 +102,7 @@ pub 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 silent: bool,
+ pub(crate) silent: bool,
/// Update the modification time of each target as though a touch target had been
/// executed.
@@ -113,14 +113,14 @@ pub 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 touch: bool,
+ pub(crate) 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 targets_or_macros: Vec<String>,
+ pub(crate) targets_or_macros: Vec<String>,
}
impl Args {
@@ -158,17 +158,17 @@ impl Args {
Args::from_iter(args)
}
- pub fn from_env_and_args() -> Args {
+ pub(crate) fn from_env_and_args() -> Args {
let env_makeflags = env::var("MAKEFLAGS").unwrap_or_default();
let args = env::args_os();
Self::from_given_args_and_given_env(args, env_makeflags)
}
- pub fn targets(&self) -> impl Iterator<Item = &String> {
+ pub(crate) fn targets(&self) -> impl Iterator<Item = &String> {
self.targets_or_macros.iter().filter(|x| !x.contains('='))
}
- pub fn macros(&self) -> impl Iterator<Item = &String> {
+ pub(crate) fn macros(&self) -> impl Iterator<Item = &String> {
self.targets_or_macros.iter().filter(|x| x.contains('='))
}
}