Skip to content

Commit

Permalink
Renames env vars, and changes parameter to self
Browse files Browse the repository at this point in the history
Co-authored-by: jrray <jrray@jrray.org>
Signed-off-by: David Gilligan-Cook <dcook@imageworks.com>
  • Loading branch information
dcookspi and jrray committed Jul 23, 2024
1 parent d5b3a69 commit bbef9e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions crates/spk-cli/common/src/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -1126,19 +1126,19 @@ pub struct DecisionFormatterSettings {
/// directory and named
/// `<solver_file_prefix>_YYYYmmdd_HHMMSS_nnnnnnnn_<solver_kind>`. 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<std::path::PathBuf>,

/// 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,
}

Expand Down
4 changes: 2 additions & 2 deletions crates/spk-solve/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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<Self> {
fn include_output(self, other_output: &OutputKind) -> Result<Self> {
match other_output {
OutputKind::Println => match self {
OutputKind::Println => Ok(self.clone()),
Expand Down

0 comments on commit bbef9e3

Please sign in to comment.