Skip to content

Commit

Permalink
Revert keep_temp_files back to default match arm; add documentation o…
Browse files Browse the repository at this point in the history
…f cleaning process
  • Loading branch information
t-nil committed Jan 17, 2024
1 parent f557d4e commit c4d7128
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,25 @@ async fn main() -> anyhow::Result<()> {
_ = signal::ctrl_c() => Err(anyhow!("ctrl_c")),
};

// Final cleanup. Samples are already deleted (if wished by the user) during `command::sample_encode::run`.
temporary::clean(keep).await;

out
}

impl Command {
// IMPORTANT: All clauses mentioned explicitly to enforce keeping this
// in sync with the list of commands that expose args::Sample.
/// This decides what commands will keep temp files.
///
/// # Important
///
/// Add commands using the sample sub-args here referencing the `keep` flag,
/// or the temp files will be removed anyways.
fn keep_temp_files(&self) -> bool {
match self {
Self::SampleEncode(args) => args.sample.keep,
Self::CrfSearch(args) => args.sample.keep,
Self::AutoEncode(args) => args.search.sample.keep,
Self::Vmaf(_) => false,
Self::Encode(_) => false,
Self::PrintCompletions(_) => false,
_ => false,
}
}
}

0 comments on commit c4d7128

Please sign in to comment.