aboutsummaryrefslogtreecommitdiffstats
path: root/src/args.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/args.rs')
-rw-r--r--src/args.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/args.rs b/src/args.rs
index 8fde78a..fe976ed 100644
--- a/src/args.rs
+++ b/src/args.rs
@@ -27,6 +27,13 @@ struct CLIArgs {
#[structopt(name = "PATH", parse(from_os_str))]
path: Option<PathBuf>,
+ /// The name of a directory index file to serve, like "index.html"
+ ///
+ /// Normally, when miniserve serves a directory, it creates a listing for that directory.
+ /// However, if a directory contains this file, miniserve will serve that file instead.
+ #[structopt(long, parse(from_os_str), name="index_file")]
+ index: Option<PathBuf>,
+
/// Port to use
#[structopt(short = "p", long = "port", default_value = "8080")]
port: u16,
@@ -108,8 +115,8 @@ fn parse_auth(src: &str) -> Result<auth::RequiredAuth, ContextualError> {
};
match second_part {
- "sha256" => auth::RequiredAuthPassword::Sha256(hash_bin.to_owned()),
- "sha512" => auth::RequiredAuthPassword::Sha512(hash_bin.to_owned()),
+ "sha256" => auth::RequiredAuthPassword::Sha256(hash_bin),
+ "sha512" => auth::RequiredAuthPassword::Sha512(hash_bin),
_ => return Err(ContextualError::InvalidHashMethod(second_part.to_owned())),
}
} else {
@@ -162,6 +169,7 @@ pub fn parse_args() -> crate::MiniserveConfig {
no_symlinks: args.no_symlinks,
random_route,
default_color_scheme,
+ index: args.index,
overwrite_files: args.overwrite_files,
file_upload: args.file_upload,
}