From 7ebdadbbab07f10b9f039726917a34412d0a100c Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Fri, 19 Feb 2016 20:58:56 +0000 Subject: [PATCH] close #46; needs doc update --- config/config.go | 18 ++++++++---------- utils/utils.go | 1 - 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/config/config.go b/config/config.go index 8ea436e8..20332902 100644 --- a/config/config.go +++ b/config/config.go @@ -42,21 +42,19 @@ func ParseHugo(c *setup.Controller) (*Config, error) { conf.Styles = strings.TrimPrefix(conf.Styles, "/") // Add a beginning slash to make a conf.Styles = "/" + conf.Styles - case "args": - if !c.NextArg() { - return nil, c.ArgErr() + default: + key := "--" + c.Val() + value := "true" + + if c.NextArg() { + value = c.Val() } - // Get the arguments and split the array - args := strings.Split(c.Val(), " ") - for index, element := range args { - args[index] = strings.Replace(element, "\"", "", -1) - } - - conf.Args = args + conf.Args = append(conf.Args, key, value) } } } + conf.Args = append([]string{"--source", conf.Path}, conf.Args...) return conf, nil } diff --git a/utils/utils.go b/utils/utils.go index 5716dac9..638d723f 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -170,7 +170,6 @@ func Run(c *config.Config) { commands.MainSite = nil viper.Reset() - c.Args = append([]string{"--source", c.Path}, c.Args...) commands.HugoCmd.ParseFlags(c.Args) if err := commands.HugoCmd.RunE(nil, nil); err != nil { log.Print(err)