diff --git a/main.go b/main.go index 06dc368..a00ecd0 100755 --- a/main.go +++ b/main.go @@ -34,6 +34,9 @@ type ( } ) +//go:embed templates/dir.html +var dirHTML string + func main() { if len(os.Args) < 2 { printHelp() } @@ -41,7 +44,7 @@ func main() { port := 8080 root := "/" - filesDir := "." + filesDir := "" i := 1 for { if i >= len(os.Args) { break } @@ -83,11 +86,19 @@ func main() { if !strings.HasSuffix(root, "/") { root += "/" } default: + if len(filesDir) > 0 { + fmt.Fprintf(os.Stderr, "unsupported argument: %s\n", os.Args[i]) + os.Exit(1) + } filesDir = os.Args[i] } i++ } + if len(filesDir) == 0 { + filesDir = "." + } + ignoredFiles := []string{ ".", ".DS_Store", diff --git a/templates/dir.html b/templates/dir.html index a0f5b53..562cc95 100644 --- a/templates/dir.html +++ b/templates/dir.html @@ -9,6 +9,7 @@ html { background: #101010; color: #f0f0f0; font-family: 'Monaspace Argon', monospace; + font-size: 16px; } body { @@ -55,6 +56,21 @@ a:hover { footer { padding: 1em 0; } + +@media screen and (max-width: 700px) { + body { + font-size: 12px; + } + + td { + width: auto; + } + + td:last-of-type, + th:last-of-type { + display: none; + } +}