From 6ddc38a7c13c5f7432ce1a0f74094d8820f520a0 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Fri, 22 Nov 2019 14:33:00 -0600 Subject: [PATCH] feat(bin): use `details` for hiding hidden files by default --- src/bin/http_of_dir.ml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/bin/http_of_dir.ml b/src/bin/http_of_dir.ml index 07e03135..5a37a34f 100644 --- a/src/bin/http_of_dir.ml +++ b/src/bin/http_of_dir.ml @@ -42,6 +42,8 @@ let (//) = Filename.concat let encode_path s = U.percent_encode ~skip:(fun c -> c='/') s +let is_hidden s = String.length s>0 && s.[0] = '.' + let html_list_dir ~top ~parent d : string = let entries = Sys.readdir @@ (top // d) in Array.sort compare entries; @@ -57,8 +59,13 @@ let html_list_dir ~top ~parent d : string = Printf.bprintf body " (parent directory) \n" p; end; Printf.bprintf body "