From bbef9e3c749b5318797db84565391bf9ebea8acd Mon Sep 17 00:00:00 2001 From: dcookspi <92065525+dcookspi@users.noreply.github.com> Date: Tue, 23 Jul 2024 11:27:58 -0700 Subject: [PATCH] Renames env vars, and changes parameter to self Co-authored-by: jrray Signed-off-by: David Gilligan-Cook --- crates/spk-cli/common/src/flags.rs | 14 +++++++------- crates/spk-solve/src/io.rs | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/spk-cli/common/src/flags.rs b/crates/spk-cli/common/src/flags.rs index a66b5bfc44..c10f82d41b 100644 --- a/crates/spk-cli/common/src/flags.rs +++ b/crates/spk-cli/common/src/flags.rs @@ -41,9 +41,9 @@ mod flags_test; static SPK_NO_RUNTIME: &str = "SPK_NO_RUNTIME"; static SPK_KEEP_RUNTIME: &str = "SPK_KEEP_RUNTIME"; -static SPK_OUTPUT_TO_DIR: &str = "SPK_OUTPUT_TO_DIR"; -static SPK_OUTPUT_TO_DIR_MIN_VERBOSITY: &str = "SPK_OUTPUT_TO_DIR_MIN_VERBOSITY"; -static SPK_OUTPUT_FILE_PREFIX: &str = "SPK_OUTPUT_FILE_PREFIX"; +static SPK_SOLVER_OUTPUT_TO_DIR: &str = "SPK_SOLVER_OUTPUT_TO_DIR"; +static SPK_SOLVER_OUTPUT_TO_DIR_MIN_VERBOSITY: &str = "SPK_SOLVER_OUTPUT_TO_DIR_MIN_VERBOSITY"; +static SPK_SOLVER_OUTPUT_FILE_PREFIX: &str = "SPK_SOLVER_OUTPUT_FILE_PREFIX"; #[derive(Args, Clone)] pub struct Runtime { @@ -1126,19 +1126,19 @@ pub struct DecisionFormatterSettings { /// directory and named /// `_YYYYmmdd_HHMMSS_nnnnnnnn_`. See /// --output-file-prefix for the default prefix and how to override it. - #[clap(long, env = SPK_OUTPUT_TO_DIR, value_hint = ValueHint::FilePath)] + #[clap(long, env = SPK_SOLVER_OUTPUT_TO_DIR, value_hint = ValueHint::FilePath)] output_to_dir: Option, /// Set the minimum verbosity for solvers when outputting to a - /// file. Has no affect unless --output-to-file is also specified. + /// file. Has no effect unless --output-to-file is also specified. /// Verbosity set (-v) higher than this minimum will override it. - #[clap(long, default_value_t=2, env = SPK_OUTPUT_TO_DIR_MIN_VERBOSITY)] + #[clap(long, default_value_t=2, env = SPK_SOLVER_OUTPUT_TO_DIR_MIN_VERBOSITY)] output_to_dir_min_verbosity: u8, /// Override the default solver output filename prefix. The /// current date, time, and solver kind name will be appended to /// this prefix to produce the file name for each solver. - #[clap(long, default_value_t=String::from(DEFAULT_SOLVER_RUN_FILE_PREFIX), env = SPK_OUTPUT_FILE_PREFIX)] + #[clap(long, default_value_t=String::from(DEFAULT_SOLVER_RUN_FILE_PREFIX), env = SPK_SOLVER_OUTPUT_FILE_PREFIX)] output_file_prefix: String, } diff --git a/crates/spk-solve/src/io.rs b/crates/spk-solve/src/io.rs index ef866c7b15..09c9d43588 100644 --- a/crates/spk-solve/src/io.rs +++ b/crates/spk-solve/src/io.rs @@ -754,7 +754,7 @@ impl OutputKind { .expect(UNABLE_TO_WRITE_OUTPUT_MESSAGE); file_lock .write_all("\n".as_bytes()) - .expect("Unable to write solver output newline to file"); + .expect(UNABLE_TO_WRITE_OUTPUT_MESSAGE); } OutputKind::PrintlnAndToFile(f) => { let mut file_lock = f.lock().expect(UNABLE_TO_GET_OUTPUT_FILE_LOCK); @@ -796,7 +796,7 @@ impl OutputKind { /// output if any. /// /// This will error if any other output kind is given as the parameter. - fn include_output(&self, other_output: &OutputKind) -> Result { + fn include_output(self, other_output: &OutputKind) -> Result { match other_output { OutputKind::Println => match self { OutputKind::Println => Ok(self.clone()),