aboutsummaryrefslogtreecommitdiffstats
path: root/src/args.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/args.rs')
-rw-r--r--src/args.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/args.rs b/src/args.rs
index 72ade7b..ee9cb7e 100644
--- a/src/args.rs
+++ b/src/args.rs
@@ -1,3 +1,4 @@
+use std::fmt::Display;
use std::net::IpAddr;
use std::path::PathBuf;
@@ -15,6 +16,21 @@ pub enum MediaType {
Video,
}
+#[derive(ValueEnum, Clone)]
+pub enum SizeDisplay {
+ Human,
+ Exact,
+}
+
+impl Display for SizeDisplay {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ match self {
+ SizeDisplay::Human => write!(f, "human"),
+ SizeDisplay::Exact => write!(f, "exact"),
+ }
+ }
+}
+
#[derive(Parser)]
#[command(name = "miniserve", author, about, version)]
pub struct CliArgs {
@@ -350,6 +366,10 @@ pub struct CliArgs {
/// Currently incompatible with -P|--no-symlinks (see https://github.com/messense/dav-server-rs/issues/37)
#[arg(long, env = "MINISERVE_ENABLE_WEBDAV", conflicts_with = "no_symlinks")]
pub enable_webdav: bool,
+
+ /// Show served file size in exact bytes.
+ #[arg(long, default_value_t = SizeDisplay::Human, env = "MINISERVE_SIZE_DISPLAY")]
+ pub size_display: SizeDisplay,
}
/// Checks whether an interface is valid, i.e. it can be parsed into an IP address