From 6e914d213ecfd6b91d2968bbd089dc70a4198ca6 Mon Sep 17 00:00:00 2001 From: asoseil Date: Mon, 16 Oct 2017 21:57:09 +0200 Subject: [PATCH] fixed text --- cmd.go | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/cmd.go b/cmd.go index 8099762..a9cdd65 100644 --- a/cmd.go +++ b/cmd.go @@ -8,7 +8,7 @@ import ( "time" ) -// Tool options customizable +// Tool options customizable, should be moved in Cmd type tool struct { dir bool status bool @@ -35,6 +35,7 @@ type Cmd struct { Method string `yaml:"method,omitempty" json:"method,omitempty"` Args []string `yaml:"args,omitempty" json:"args,omitempty"` method []string + tool bool name, startTxt, endTxt string } @@ -109,9 +110,31 @@ func (r *realize) run(p *cli.Context) error { wg.Add(len(r.Schema)) } for k, elm := range r.Schema { + // command start using name flag if p.String("name") != "" && r.Schema[k].Name != p.String("name") { continue } + //fields := reflect.Indirect(reflect.ValueOf(&r.Schema[k].Cmds)) + //// Loop struct Cmds fields + //for i := 0; i < fields.NumField(); i++ { + // field := fields.Type().Field(i).Name + // if fields.FieldByName(field).Type().Name() == "Cmd" { + // v := fields.FieldByName(field) + // // Loop struct Cmd + // for i := 0; i < v.NumField(); i++ { + // f := v.Field(i) + // if f.IsValid() { + // if f.CanSet() { + // switch f.Kind() { + // case reflect.Bool: + // case reflect.String: + // case reflect.Slice: + // } + // } + // } + // } + // } + //} if elm.Cmds.Fmt.Status { if len(elm.Cmds.Fmt.Args) == 0 { elm.Cmds.Fmt.Args = []string{"-s", "-w", "-e", "./.."} @@ -164,7 +187,7 @@ func (r *realize) run(p *cli.Context) error { Args: append([]string{}, elm.Cmds.Build.Args...), method: replace([]string{"go", "build"}, r.Schema[k].Cmds.Build.Method), name: "Build", - startTxt: "Bulding...", + startTxt: "Building...", endTxt: "Built", }