rwiki/tool.go

32 lines
873 B
Go

package rwiki
import (
"vultras.su/core/cli/mtool"
"vultras.su/core/bond"
"vultras.su/service/rwiki/server"
"log"
)
var Tool = mtool.T("rwiki").Func(func(flags *mtool.Flags){
var (
addr string
opts server.ServerOptions
)
flags.StringVar(&addr, "a", ":8080", "address string")
flags.StringVar(&opts.WikiPath, "wiki", "wiki", "path to wiki files")
flags.StringVar(&opts.WebPath, "web", "web", "path to static web files")
flags.StringVar(&opts.WikiExt, "ext", ".pmd", "wiki file exitension")
flags.BoolVar(&opts.AddFileNavigation, "filenav", true, "generate file navigation")
flags.BoolVar(&opts.AddDocNavigation, "docnav", true, "generate document navigation")
flags.Parse()
srv := bond.Server{
Addr: addr,
Handler: bond.Root(server.New(opts)),
}
log.Println("Serving at ", addr)
err := srv.ListenAndServe()
if err != nil {
panic(err)
}
})