Skip to content

Commit

Permalink
Re-add sign --force
Browse files Browse the repository at this point in the history
  • Loading branch information
Kijewski committed Sep 15, 2023
1 parent af23321 commit de9a1b2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/sign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ struct CommonArgs {
pub(crate) enum Error {
#[error("could not determine `context` string by the input name")]
Context(#[from] ImplicitContextError),
#[error("output exists, use `--force` allow replacing a file")]
Exists,
#[error("could not gather signature data")]
GatherSignatureData(#[from] GatherSignatureDataError),
#[error("could not open input file")]
Expand Down Expand Up @@ -99,6 +101,9 @@ pub(crate) fn main(args: Cli) -> Result<(), Error> {
let keys = read_signing_keys(keys)?;

let output_path = args.output.as_deref().unwrap_or(&args.input).normalize();
if args.output.is_some() && !args.force {
return Err(Error::Exists);
}
let output_dir = output_path.parent().unwrap_or(Path::new("."));
let mut output_file = tempfile::Builder::new()
.prefix(".zipsign.")
Expand Down

0 comments on commit de9a1b2

Please sign in to comment.