From c7535b9c259804bba3c9a6114f42e4ffb3373eec Mon Sep 17 00:00:00 2001 From: bogem Date: Mon, 20 Feb 2017 13:50:34 +0500 Subject: [PATCH] commands: Remove flagChanged from commandeer --- commands/hugo.go | 4 ++-- commands/new.go | 4 ++-- commands/server.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/commands/hugo.go b/commands/hugo.go index 49b0fc7e..cfadd226 100644 --- a/commands/hugo.go +++ b/commands/hugo.go @@ -461,13 +461,13 @@ func (c *commandeer) initializeFlags(cmd *cobra.Command) { } 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 diff --git a/commands/new.go b/commands/new.go index a54ad5d2..107c12d9 100644 --- a/commands/new.go +++ b/commands/new.go @@ -95,11 +95,11 @@ func NewContent(cmd *cobra.Command, args []string) error { 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) } diff --git a/commands/server.go b/commands/server.go index 8e35d30e..3e767377 100644 --- a/commands/server.go +++ b/commands/server.go @@ -108,7 +108,7 @@ func server(cmd *cobra.Command, args []string) error { c := newCommandeer(cfg) - if c.flagChanged(cmd.Flags(), "disableLiveReload") { + if flagChanged(cmd.Flags(), "disableLiveReload") { c.Set("disableLiveReload", disableLiveReload) } @@ -125,7 +125,7 @@ func server(cmd *cobra.Command, args []string) error { 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) } -- 2.30.2