Merge pull request #113 from tockins/dev

go clean and fix support
This commit is contained in:
Alessio Pracchia 2017-11-05 22:59:27 +01:00 committed by GitHub
commit f2b24eb55f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 89 additions and 1 deletions

View File

@ -49,7 +49,7 @@ Various operations can be programmed for each project, which can be executed at
- Custom arguments to pass at each project
- Docker support (only with polling watcher)
- Live reload on file change (extensions and paths customizable)
- Support for most go commands (install, build, run, vet, test, fmt and much more)
- Support for most go commands (install, build, run, vet, test, fmt, fix, clean)
- Web panel for a smart control of the workflow
Next features and informations

View File

@ -509,6 +509,94 @@ func main() {
return nil
},
},
{
Before: func(d interact.Context) error {
d.SetDef(false, green.regular("(n)"))
return nil
},
Quest: interact.Quest{
Options: yellow.regular("[y/n]"),
Msg: "Enable go fix",
Resolve: func(d interact.Context) bool {
val, _ := d.Ans().Bool()
return val
},
},
Subs: []*interact.Question{
{
Before: func(d interact.Context) error {
d.SetDef("", green.regular("(none)"))
return nil
},
Quest: interact.Quest{
Options: yellow.regular("[string]"),
Msg: "Fix additional arguments",
},
Action: func(d interact.Context) interface{} {
val, err := d.Ans().String()
if err != nil {
return d.Err()
}
if val != "" {
r.Schema[len(r.Schema)-1].Cmds.Fix.Args = append(r.Schema[len(r.Schema)-1].Cmds.Fix.Args, val)
}
return nil
},
},
},
Action: func(d interact.Context) interface{} {
val, err := d.Ans().Bool()
if err != nil {
return d.Err()
}
r.Schema[len(r.Schema)-1].Cmds.Fix.Status = val
return nil
},
},
{
Before: func(d interact.Context) error {
d.SetDef(false, green.regular("(n)"))
return nil
},
Quest: interact.Quest{
Options: yellow.regular("[y/n]"),
Msg: "Enable go clean",
Resolve: func(d interact.Context) bool {
val, _ := d.Ans().Bool()
return val
},
},
Subs: []*interact.Question{
{
Before: func(d interact.Context) error {
d.SetDef("", green.regular("(none)"))
return nil
},
Quest: interact.Quest{
Options: yellow.regular("[string]"),
Msg: "Clean additional arguments",
},
Action: func(d interact.Context) interface{} {
val, err := d.Ans().String()
if err != nil {
return d.Err()
}
if val != "" {
r.Schema[len(r.Schema)-1].Cmds.Clean.Args = append(r.Schema[len(r.Schema)-1].Cmds.Clean.Args, val)
}
return nil
},
},
},
Action: func(d interact.Context) interface{} {
val, err := d.Ans().Bool()
if err != nil {
return d.Err()
}
r.Schema[len(r.Schema)-1].Cmds.Clean.Status = val
return nil
},
},
{
Before: func(d interact.Context) error {
d.SetDef(false, green.regular("(n)"))