Don't overwrite files without the -f/--force flag
This commit is contained in:
parent
c69bbec8df
commit
8345de8f0c
|
@ -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 =>
|
||||
|
|
|
@ -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<PathBuf>,
|
||||
|
||||
#[argh(switch, short='f')]
|
||||
/// overwrite any existing files in the output directory
|
||||
pub force: bool,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue