mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-29 12:02:01 -05:00
commands: Remove flagChanged from commandeer
This commit is contained in:
parent
eb27c47fc5
commit
c7535b9c25
3 changed files with 6 additions and 6 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue