From 562ced11abdec8555dd1c37aa2c5512a2f82d41b Mon Sep 17 00:00:00 2001 From: alessio Date: Mon, 22 Aug 2016 00:56:07 +0200 Subject: [PATCH] name value fixed --- realize/config.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/realize/config.go b/realize/config.go index 631d7e5..dcbb096 100644 --- a/realize/config.go +++ b/realize/config.go @@ -6,9 +6,9 @@ import ( "gopkg.in/urfave/cli.v2" "gopkg.in/yaml.v2" "io/ioutil" + "log" "os" "strings" - "log" ) // Config struct contains the general informations about a project @@ -21,7 +21,7 @@ type Config struct { // NameParam check the project name presence. If empty takes the working directory name func nameParam(params *cli.Context) string { var name string - if params.String("name") == "" && params.String("path") == ""{ + if params.String("name") == "" && params.String("path") == "" { dir, err := os.Getwd() if err != nil { log.Fatal(Red(err)) @@ -29,7 +29,8 @@ func nameParam(params *cli.Context) string { wd := strings.Split(dir, "/") return wd[len(wd)-1] } else if params.String("path") != "/" { - name = params.String("path") + name = slash(params.String("path")) + name = name[1:] } else { name = params.String("name") } @@ -52,7 +53,7 @@ func New(params *cli.Context) *Config { Projects: []Project{ { Name: nameParam(params), - Path: params.String("path"), + Path: slash(params.String("path")), Build: params.Bool("build"), Bin: boolParam(params.Bool("bin")), Run: boolParam(params.Bool("run")), @@ -123,7 +124,7 @@ func (h *Config) Add(params *cli.Context) error { if err == nil { new := Project{ Name: nameParam(params), - Path: params.String("path"), + Path: slash(params.String("path")), Build: params.Bool("build"), Bin: boolParam(params.Bool("bin")), Run: boolParam(params.Bool("run")),