shithub: hugo

Download patch

ref: c7535b9c259804bba3c9a6114f42e4ffb3373eec
parent: eb27c47fc5102e05945f3beb892a839284d56dc8
author: bogem <[email protected]>
date: Mon Feb 20 08:50:34 EST 2017

commands: Remove flagChanged from commandeer

--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -461,13 +461,13 @@
 }
 
 func (c *commandeer) setValueFromFlag(flags *flag.FlagSet, key string) {
-	if c.flagChanged(flags, key) {
+	if flagChanged(flags, key) {
 		f := flags.Lookup(key)
 		c.Set(key, f.Value.String())
 	}
 }
 
-func (c *commandeer) flagChanged(flags *flag.FlagSet, key string) bool {
+func flagChanged(flags *flag.FlagSet, key string) bool {
 	flag := flags.Lookup(key)
 	if flag == nil {
 		return false
--- a/commands/new.go
+++ b/commands/new.go
@@ -95,11 +95,11 @@
 
 	c := newCommandeer(cfg)
 
-	if c.flagChanged(cmd.Flags(), "format") {
+	if flagChanged(cmd.Flags(), "format") {
 		c.Set("metaDataFormat", configFormat)
 	}
 
-	if c.flagChanged(cmd.Flags(), "editor") {
+	if flagChanged(cmd.Flags(), "editor") {
 		c.Set("newContentEditor", contentEditor)
 	}
 
--- a/commands/server.go
+++ b/commands/server.go
@@ -108,7 +108,7 @@
 
 	c := newCommandeer(cfg)
 
-	if c.flagChanged(cmd.Flags(), "disableLiveReload") {
+	if flagChanged(cmd.Flags(), "disableLiveReload") {
 		c.Set("disableLiveReload", disableLiveReload)
 	}
 
@@ -125,7 +125,7 @@
 	if err == nil {
 		l.Close()
 	} else {
-		if c.flagChanged(serverCmd.Flags(), "port") {
+		if flagChanged(serverCmd.Flags(), "port") {
 			// port set explicitly by user -- he/she probably meant it!
 			return newSystemErrorF("Server startup failed: %s", err)
 		}