Skip to content

Commit

Permalink
Merge pull request #113 from tockins/dev
Browse files Browse the repository at this point in the history
go clean and fix support
  • Loading branch information
Alessio Pracchia authored Nov 5, 2017
2 parents 5d968b7 + ae54971 commit f2b24eb
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
88 changes: 88 additions & 0 deletions realize.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)"))
Expand Down

0 comments on commit f2b24eb

Please sign in to comment.