From 3e8c6cc81202501465dcc82759519483644a8564 Mon Sep 17 00:00:00 2001 From: ari melody Date: Sun, 8 Jun 2025 02:27:00 +0100 Subject: [PATCH] add readme, improve help message --- README.md | 21 +++++++++++++++++++++ main.go | 10 +++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..f30a892 --- /dev/null +++ b/README.md @@ -0,0 +1,21 @@ +# indir + +a nifty static file indexer + +indir provides a nice, simple frontend for browsing your web directories! +heavily inspired by traditional file indexers provided by the likes of nginx +and apache, with some modern amenities on top :) + +## usage +```sh +indir [--host address] [--port port] [--root http_root] directory + + --help shows this help message + --host address hosts on the specified address + --port port hosts on the specified port + --root http_root hosts on the specified subdirectory, i.e. `/files/` +``` + +## to-do: +- [ ] directory header from readme file +- [ ] directory stylesheet overrides diff --git a/main.go b/main.go index 84d2e60..043ac12 100755 --- a/main.go +++ b/main.go @@ -295,6 +295,14 @@ func HTTPLog(next http.Handler) http.Handler { } func printHelp() { - fmt.Printf("%s [--host address] [--port port] [--root http_root] directory\n", os.Args[0]) + fmt.Printf( + `%s [--host address] [--port port] [--root http_root] directory + + --help shows this help message + --host address hosts on the specified address + --port port hosts on the specified port + --root http_root hosts on the specified subdirectory, i.e. `+"`/files/`\n", + os.Args[0], + ) os.Exit(0) }