diff options
author | spf13 <[email protected]> | 2013-07-26 18:06:13 -0400 |
---|---|---|
committer | spf13 <[email protected]> | 2013-07-26 18:06:13 -0400 |
commit | 7ab28c564f89b32fd1a3db78a34db14587f54cad (patch) | |
tree | f906ffd9377131fd774e5ea5f10e7421641b826a /main.go | |
parent | 92c31bbe10a68bb29c62535f5a7a6b4bfc80a21d (diff) | |
download | hugo-7ab28c564f89b32fd1a3db78a34db14587f54cad.tar.gz hugo-7ab28c564f89b32fd1a3db78a34db14587f54cad.zip |
Adding support for destination dir, split out static
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 35 |
1 files changed, 20 insertions, 15 deletions
@@ -27,19 +27,20 @@ import ( ) var ( - baseUrl = flag.StringP("base-url", "b", "", "hostname (and path) to the root eg. http://spf13.com/") - cfgfile = flag.String("config", "", "config file (default is path/config.yaml|json|toml)") - checkMode = flag.Bool("check", false, "analyze content and provide feedback") - draft = flag.BoolP("build-drafts", "d", false, "include content marked as draft") - help = flag.BoolP("help", "h", false, "show this help") - path = flag.StringP("source", "s", "", "filesystem path to read files relative from") - verbose = flag.BoolP("verbose", "v", false, "verbose output") - version = flag.Bool("version", false, "which version of hugo") - cpuprofile = flag.Int("profile", 0, "Number of times to create the site and profile it") - watchMode = flag.BoolP("watch", "w", false, "watch filesystem for changes and recreate as needed") - server = flag.BoolP("server", "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/ ") + baseUrl = flag.StringP("base-url", "b", "", "hostname (and path) to the root eg. http://spf13.com/") + cfgfile = flag.String("config", "", "config file (default is path/config.yaml|json|toml)") + checkMode = flag.Bool("check", false, "analyze content and provide feedback") + draft = flag.BoolP("build-drafts", "D", false, "include content marked as draft") + help = flag.BoolP("help", "h", false, "show this help") + source = flag.StringP("source", "s", "", "filesystem path to read files relative from") + destination = flag.StringP("destination", "d", "", "filesystem path to write files to") + verbose = flag.BoolP("verbose", "v", false, "verbose output") + version = flag.Bool("version", false, "which version of hugo") + cpuprofile = flag.Int("profile", 0, "Number of times to create the site and profile it") + watchMode = flag.BoolP("watch", "w", false, "watch filesystem for changes and recreate as needed") + server = flag.BoolP("server", "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() { @@ -57,11 +58,15 @@ func main() { usage() } - config := hugolib.SetupConfig(cfgfile, path) + config := hugolib.SetupConfig(cfgfile, source) config.BuildDrafts = *draft config.UglyUrls = *uglyUrls config.Verbose = *verbose + if *destination != "" { + config.PublishDir = *destination + } + if *baseUrl != "" { config.BaseUrl = *baseUrl } else if *server { @@ -194,7 +199,7 @@ func getDirList(c *hugolib.Config) []string { return nil } - filepath.Walk(c.GetAbsPath(c.SourceDir), walker) + filepath.Walk(c.GetAbsPath(c.ContentDir), walker) filepath.Walk(c.GetAbsPath(c.LayoutDir), walker) return a |