From 4b4d1d78921395f5ffdea0ff94815e100b3144ab Mon Sep 17 00:00:00 2001 From: Gaurav Date: Thu, 25 Aug 2022 21:59:32 -0400 Subject: Add tests for `--readme` --- src/renderer.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/renderer.rs b/src/renderer.rs index 7ec48b0..40aa7cd 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -168,9 +168,11 @@ pub fn page( } } @if let Some(readme) = readme { - div { - h3 { (readme.0) } - (PreEscaped (readme.1)); + div id="readme" { + h3 id="readme-filename" { (readme.0) } + div id="readme-contents" { + (PreEscaped (readme.1)) + }; } } a.back href="#top" { -- cgit v1.2.3 From f709dfd43a9031604646a4c96291388c43e36b8a Mon Sep 17 00:00:00 2001 From: Kian-Meng Ang Date: Wed, 14 Sep 2022 22:05:01 +0800 Subject: Fix typos Found via `codespell -L crate`. --- src/archive.rs | 2 +- src/args.rs | 2 +- src/listing.rs | 4 ++-- src/main.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/archive.rs b/src/archive.rs index 29f60c1..940d4b6 100644 --- a/src/archive.rs +++ b/src/archive.rs @@ -250,7 +250,7 @@ where continue; } let current_entry_name = entry_path.file_name().ok_or_else(|| { - ContextualError::InvalidPathError("Invalid file or direcotory name".to_string()) + ContextualError::InvalidPathError("Invalid file or directory name".to_string()) })?; if entry_metadata.is_file() { let mut f = File::open(&entry_path) diff --git a/src/args.rs b/src/args.rs index a769256..a8718bd 100644 --- a/src/args.rs +++ b/src/args.rs @@ -203,7 +203,7 @@ pub struct CliArgs { pub readme: bool, } -/// Checks wether an interface is valid, i.e. it can be parsed into an IP address +/// Checks whether an interface is valid, i.e. it can be parsed into an IP address fn parse_interface(src: &str) -> Result { src.parse::() } diff --git a/src/listing.rs b/src/listing.rs index 82b4cdb..851f4ac 100644 --- a/src/listing.rs +++ b/src/listing.rs @@ -121,12 +121,12 @@ impl Entry { } } - /// Returns wether the entry is a directory + /// Returns whether the entry is a directory pub fn is_dir(&self) -> bool { self.entry_type == EntryType::Directory } - /// Returns wether the entry is a file + /// Returns whether the entry is a file pub fn is_file(&self) -> bool { self.entry_type == EntryType::File } diff --git a/src/main.rs b/src/main.rs index b46262d..9348a34 100644 --- a/src/main.rs +++ b/src/main.rs @@ -299,7 +299,7 @@ fn configure_app(app: &mut web::ServiceConfig, conf: &MiniserveConfig) { if conf.spa { files = files.default_handler( NamedFile::open(&conf.path.join(index_file)) - .expect("Cant open SPA index file."), + .expect("Can't open SPA index file."), ); } } -- cgit v1.2.3 From 384e0291f90b4c676132ec6a71a30b762358a779 Mon Sep 17 00:00:00 2001 From: Sven-Hendrik Haase Date: Wed, 14 Sep 2022 23:03:16 +0200 Subject: Fully qualify clap_complete::generate --- src/main.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index b46262d..08cb19a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,7 +11,6 @@ use actix_web::{middleware, App, HttpRequest, HttpResponse}; use actix_web_httpauth::middleware::HttpAuthentication; use anyhow::Result; use clap::{crate_version, IntoApp, Parser}; -use clap_complete::generate; use log::{error, warn}; use qrcodegen::{QrCode, QrCodeEcc}; use yansi::{Color, Paint}; @@ -35,7 +34,7 @@ fn main() -> Result<()> { if let Some(shell) = args.print_completions { let mut clap_app = args::CliArgs::command(); let app_name = clap_app.get_name().to_string(); - generate(shell, &mut clap_app, app_name, &mut io::stdout()); + clap_complete::generate(shell, &mut clap_app, app_name, &mut io::stdout()); return Ok(()); } -- cgit v1.2.3