1
0
mirror of https://github.com/danog/gojekyll.git synced 2024-12-11 17:00:02 +01:00
gojekyll/commands/serve.go

21 lines
661 B
Go
Raw Permalink Normal View History

2017-08-11 19:25:51 +02:00
package commands
import (
"github.com/osteele/gojekyll/server"
"github.com/osteele/gojekyll/site"
)
var (
serve = app.Command("serve", "Serve your site locally").Alias("server").Alias("s")
open = serve.Flag("open-url", "Launch your site in a browser").Short('o').Bool()
_ = serve.Flag("host", "Host to bind to").Short('H').Action(stringVar("host", &options.Host)).String()
_ = serve.Flag("port", "Port to listen on").Short('P').Action(intVar("port", &options.Port)).Int()
)
func serveCommand(site *site.Site) error {
server := server.Server{Site: site}
return server.Run(*open, func(label, value string) {
logger.label(label, value)
})
}