From 848557762c1c4eed2ba16713ead97308d1841220 Mon Sep 17 00:00:00 2001 From: marawan ragab Date: Sun, 10 May 2020 17:14:51 -0400 Subject: make sure archiving is opt-in --- src/args.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/args.rs') diff --git a/src/args.rs b/src/args.rs index 49fe276..1525b41 100644 --- a/src/args.rs +++ b/src/args.rs @@ -84,9 +84,15 @@ struct CLIArgs { #[structopt(short = "o", long = "overwrite-files")] overwrite_files: bool, - /// Disable archive generation - #[structopt(short = "r", long = "disable-archives")] - disable_archives: bool, + /// Enable tar archive generation + #[structopt(short = "r", long = "tar-enabled")] + tar_enabled: bool, + + /// Enable zip archive generation + /// Zipping large directories can result in out-of-memory exception + /// because zip generation is done in memory and cannot be sent on the fly + #[structopt(short = "z", long = "zip-enabled")] + zip_enabled: bool, } /// Checks wether an interface is valid, i.e. it can be parsed into an IP address @@ -176,7 +182,8 @@ pub fn parse_args() -> crate::MiniserveConfig { index: args.index, overwrite_files: args.overwrite_files, file_upload: args.file_upload, - archives: !args.disable_archives, + tar_enabled: args.tar_enabled, + zip_enabled: args.zip_enabled, } } -- cgit v1.2.3 From 97cf52b64edf23a6b5391569219eeebca86d52a0 Mon Sep 17 00:00:00 2001 From: marawan ragab Date: Sun, 10 May 2020 17:34:22 -0400 Subject: rename variables correctly --- src/args.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/args.rs') diff --git a/src/args.rs b/src/args.rs index 1525b41..ea4e90f 100644 --- a/src/args.rs +++ b/src/args.rs @@ -85,14 +85,14 @@ struct CLIArgs { overwrite_files: bool, /// Enable tar archive generation - #[structopt(short = "r", long = "tar-enabled")] - tar_enabled: bool, + #[structopt(short = "r", long = "enable-tar")] + enable_tar: bool, /// Enable zip archive generation /// Zipping large directories can result in out-of-memory exception /// because zip generation is done in memory and cannot be sent on the fly - #[structopt(short = "z", long = "zip-enabled")] - zip_enabled: bool, + #[structopt(short = "z", long = "enable-zip")] + enable_zip: bool, } /// Checks wether an interface is valid, i.e. it can be parsed into an IP address @@ -182,8 +182,8 @@ pub fn parse_args() -> crate::MiniserveConfig { index: args.index, overwrite_files: args.overwrite_files, file_upload: args.file_upload, - tar_enabled: args.tar_enabled, - zip_enabled: args.zip_enabled, + tar_enabled: args.enable_tar, + zip_enabled: args.enable_zip, } } -- cgit v1.2.3