diff options
author | spf13 <[email protected]> | 2013-07-19 00:10:42 -0700 |
---|---|---|
committer | spf13 <[email protected]> | 2013-07-19 00:10:42 -0700 |
commit | 8fae5f0dd68476ae1e58704abccb61a34a2989df (patch) | |
tree | 85db18f13e53205a1ea6ff9ddb1fc2f3610c904e /main.go | |
parent | dcd8ff716ac539fab260d3db366428297bf601d1 (diff) | |
download | hugo-8fae5f0dd68476ae1e58704abccb61a34a2989df.tar.gz hugo-8fae5f0dd68476ae1e58704abccb61a34a2989df.zip |
Default is now pretty urls (without .html)
Adding --uglyurls option to retain previous behavior
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -14,10 +14,10 @@ package main import ( - "github.com/spf13/hugo/hugolib" "flag" "fmt" "github.com/howeyc/fsnotify" + "github.com/spf13/hugo/hugolib" "net/http" "os" "path/filepath" @@ -39,6 +39,7 @@ var ( watchMode = flag.Bool("w", false, "watch filesystem for changes and recreate as needed") server = flag.Bool("s", false, "run a (very) simple web server") port = flag.String("port", "1313", "port to run web server on, default :1313") + uglyUrls = flag.Bool("uglyurls", false, "use /filename.html instead of /filename/ ") ) func usage() { @@ -58,12 +59,14 @@ func main() { config := hugolib.SetupConfig(cfgfile, path) config.BuildDrafts = *draft + config.UglyUrls = *uglyUrls + config.Verbose = *verbose if *baseUrl != "" { config.BaseUrl = *baseUrl } else if *server { - config.BaseUrl = "http://localhost:" + *port - } + config.BaseUrl = "http://localhost:" + *port + } if *version { fmt.Println("Hugo Static Site Generator v0.8") @@ -115,11 +118,11 @@ func serve(port string, config *hugolib.Config) { } func buildSite(config *hugolib.Config) *hugolib.Site { - startTime := time.Now() + startTime := time.Now() site := hugolib.NewSite(config) site.Build() site.Stats() - fmt.Printf("in %v ms\n", int(1000 * time.Since(startTime).Seconds())) + fmt.Printf("in %v ms\n", int(1000*time.Since(startTime).Seconds())) return site } @@ -145,6 +148,9 @@ func NewWatcher(c *hugolib.Config, port string, server bool) error { select { case ev := <-watcher.Event: var _ = ev + if c.Verbose { + fmt.Println(ev) + } watchChange(c) // TODO add newly created directories to the watch list case err := <-watcher.Error: |