summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVonC <vonc@laposte.net>2013-08-08 22:18:37 +0200
committerVonC <vonc@laposte.net>2013-08-08 22:21:56 +0200
commit49b8ac5fbceef9e00325800d4fa64c19723b2237 (patch)
treeb5d7ea9b98ad50276833a6437900f0811567117e
parentd89c7ec7a2fc198b92c63a1103932dff18cb37c1 (diff)
Make sure hugo --version prints the version and does *nothing* else.
Any program, when asks to print their version, only prints that, and then stops. hugo checks the config (and prints a warning message if not found), and proceeds to generate the site! Yet, the user just wanted to check the version. This patch makes sure hugo stops after printing the version.
-rw-r--r--main.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/main.go b/main.go
index 692db431d..8b91bee86 100644
--- a/main.go
+++ b/main.go
@@ -60,6 +60,11 @@ func main() {
usage()
}
+ if *version {
+ fmt.Println("Hugo Static Site Generator v0.8")
+ return
+ }
+
config := hugolib.SetupConfig(cfgfile, source)
config.BuildDrafts = *draft
config.UglyUrls = *uglyUrls
@@ -75,10 +80,6 @@ func main() {
config.PublishDir = *destination
}
- if *version {
- fmt.Println("Hugo Static Site Generator v0.8")
- }
-
if *cpuprofile != 0 {
f, err := os.Create("/tmp/hugo-cpuprofile")