aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/args.rs4
-rw-r--r--src/config.rs4
-rw-r--r--src/listing.rs4
3 files changed, 10 insertions, 2 deletions
diff --git a/src/args.rs b/src/args.rs
index 687649d..9674651 100644
--- a/src/args.rs
+++ b/src/args.rs
@@ -197,6 +197,10 @@ pub struct CliArgs {
#[cfg(feature = "tls")]
#[clap(long = "tls-key", requires = "tls-cert", value_hint = ValueHint::FilePath)]
pub tls_key: Option<PathBuf>,
+
+ /// Enable readme redering in directories
+ #[clap(long = "readme")]
+ pub readme: bool,
}
/// Checks wether an interface is valid, i.e. it can be parsed into an IP address
diff --git a/src/config.rs b/src/config.rs
index ec7ec66..9dddeb9 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -123,6 +123,9 @@ pub struct MiniserveConfig {
/// If enabled, display a wget command to recursively download the current directory
pub show_wget_footer: bool,
+ /// If enabled, render the readme from the current directory
+ pub readme: bool,
+
/// If set, use provided rustls config for TLS
#[cfg(feature = "tls")]
pub tls_rustls_config: Option<rustls::ServerConfig>,
@@ -256,6 +259,7 @@ impl MiniserveConfig {
hide_version_footer: args.hide_version_footer,
hide_theme_selector: args.hide_theme_selector,
show_wget_footer: args.show_wget_footer,
+ readme: args.readme,
tls_rustls_config: tls_rustls_server_config,
})
}
diff --git a/src/listing.rs b/src/listing.rs
index 3c77c14..458744c 100644
--- a/src/listing.rs
+++ b/src/listing.rs
@@ -283,8 +283,8 @@ pub fn directory_listing(
last_modification_date,
symlink_dest,
));
- // TODO: Pattern match, or user arg for readme name?
- if file_name.to_lowercase() == "readme.md"{
+ // TODO: Pattern match?
+ if conf.readme && file_name.to_lowercase() == "readme.md"{
readme = Some(file_name);
}
}