rwiki/tool.go

33 lines
873 B
Go
Raw Normal View History

2024-03-01 00:23:26 +03:00
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")
2024-03-01 00:23:26 +03:00
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)
}
})