Skip to content

Commit

Permalink
print help to stdout for 'markdownd -h | more'
Browse files Browse the repository at this point in the history
  • Loading branch information
aerth committed Jun 14, 2017
1 parent 9aa32d8 commit d0fe937
Showing 1 changed file with 27 additions and 5 deletions.
32 changes: 27 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ package main

import (
"flag"
"fmt"
"io/ioutil"
"log"
"math/rand"
Expand Down Expand Up @@ -57,7 +58,7 @@ var (
// log to file
var logger = log.New(os.Stderr, "", 0)

const version = "0.0.10"
const version = "0.0.11"
const sig = "[markdownd v" + version + "]\nhttps://github.com/aerth/markdownd"
const serverheader = "markdownd/" + version
const usage = `
Expand All @@ -78,14 +79,35 @@ Serve docs with header, footer, and table of contents. Disable Logs:
Serve docs only on localhost:
markdownd -http 127.0.0.1:8080 docs
FLAGS
-footer string
html footer filename for markdown requests
-header string
html header filename for markdown requests
-http string
address to listen on format 'address:port',
if address is omitted will listen on all interfaces (default ":8080")
-index string
filename to use for paths ending in '/',
try something like '-index=README.md' (default "index.md")
-log string
redirect logs to this file (default "/dev/stderr")
-plain
disable github flavored markdown
-syntax
highlight syntax in .html
-toc
generate table of contents at the top of each markdown page
`

// redefine flag Usage
func init() {
flag.Usage = func() {
println(usage)
println("FLAGS")
flag.PrintDefaults()
fmt.Println(usage)
//fmt.Println("FLAGS")
//flag.PrintDefaults()
}
rand.Seed(time.Now().UnixNano())
}
Expand All @@ -99,7 +121,7 @@ type Handler struct {

// markdown command
func main() {
println(sig)
fmt.Println(sig)
flag.Parse()
serve(flag.Args())
}
Expand Down

0 comments on commit d0fe937

Please sign in to comment.