aboutsummaryrefslogtreecommitdiffstats
path: root/src/args.rs
diff options
context:
space:
mode:
authorJonas Diemer <jonasdiemer@gmail.com>2022-08-15 20:15:57 +0000
committerJonas Diemer <jonasdiemer@gmail.com>2022-09-18 18:25:37 +0000
commite2ae526727e0154a1bc618971011788ee24e8748 (patch)
tree395e682abde8f39f4d71fd4a406f473eaec72118 /src/args.rs
parentcheck status code when restricted; fix formatting (diff)
downloadminiserve-e2ae526727e0154a1bc618971011788ee24e8748.tar.gz
miniserve-e2ae526727e0154a1bc618971011788ee24e8748.zip
Use argument -u instead of --allowed-upload-dir
Diffstat (limited to 'src/args.rs')
-rw-r--r--src/args.rs16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/args.rs b/src/args.rs
index 56c834c..8cd8ffa 100644
--- a/src/args.rs
+++ b/src/args.rs
@@ -108,28 +108,22 @@ pub struct CliArgs {
pub qrcode: bool,
/// Enable file uploading
- #[clap(short = 'u', long = "upload-files")]
- pub file_upload: bool,
-
- /// Allowed upload directories (together with -u)
- ///
- /// If this is set, uploads are only allowed into the provided directories.
- #[clap(long, requires = "file-upload", value_hint = ValueHint::FilePath)]
- pub allowed_upload_dir: Vec<PathBuf>,
+ #[clap(short = 'u', long = "upload-files", value_hint = ValueHint::FilePath, min_values = 0)]
+ pub allowed_upload_dir: Option<Vec<PathBuf>>,
/// Enable creating directories
- #[clap(short = 'U', long = "mkdir", requires = "file-upload")]
+ #[clap(short = 'U', long = "mkdir", requires = "allowed-upload-dir")]
pub mkdir_enabled: bool,
/// Specify uploadable media types
- #[clap(arg_enum, short = 'm', long = "media-type", requires = "file-upload")]
+ #[clap(arg_enum, short = 'm', long = "media-type", requires = "allowed-upload-dir")]
pub media_type: Option<Vec<MediaType>>,
/// Directly specify the uploadable media type expression
#[clap(
short = 'M',
long = "raw-media-type",
- requires = "file-upload",
+ requires = "allowed-upload-dir",
conflicts_with = "media-type"
)]
pub media_type_raw: Option<String>,