diff --git a/src/main.rs b/src/main.rs index 95d2ac2..d70822c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -253,6 +253,7 @@ fn download(server: &str, args: DownloadArgs) -> Result<(), AviaryDownloadError> .write(true) .truncate(true) .create(true) + .create_new(!args.force) .open(&path) .map_err(|e| match e.kind() { io::ErrorKind::PermissionDenied => diff --git a/src/parse.rs b/src/parse.rs index 1e276ac..714b0d8 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -61,4 +61,8 @@ pub struct DownloadArgs { /// /// A directory will be generated based on the name of the gallery if this is not set pub output: Option, + + #[argh(switch, short='f')] + /// overwrite any existing files in the output directory + pub force: bool, }