cleaning up
parent
d4f6700ce1
commit
2d2adc6c6b
|
|
@ -120,7 +120,6 @@ func pluginAction(r Runner, p config.Plugin) ui.ActionHandler {
|
||||||
if path == "" {
|
if path == "" {
|
||||||
return evt
|
return evt
|
||||||
}
|
}
|
||||||
|
|
||||||
if r.EnvFn() == nil {
|
if r.EnvFn() == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -134,20 +133,26 @@ func pluginAction(r Runner, p config.Plugin) ui.ActionHandler {
|
||||||
}
|
}
|
||||||
args[i] = arg
|
args[i] = arg
|
||||||
}
|
}
|
||||||
fn := func() {
|
|
||||||
if run(r.App(), shellOpts{clear: true, binary: p.Command, background: p.Background, args: args}) {
|
cb := func() {
|
||||||
|
opts := shellOpts{
|
||||||
|
clear: true,
|
||||||
|
binary: p.Command,
|
||||||
|
background: p.Background,
|
||||||
|
args: args,
|
||||||
|
}
|
||||||
|
if run(r.App(), opts) {
|
||||||
r.App().Flash().Info("Plugin command launched successfully!")
|
r.App().Flash().Info("Plugin command launched successfully!")
|
||||||
} else {
|
return
|
||||||
|
}
|
||||||
r.App().Flash().Info("Plugin command failed!")
|
r.App().Flash().Info("Plugin command failed!")
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if p.Confirm {
|
if p.Confirm {
|
||||||
dialog.ShowConfirm(r.App().Content.Pages, "Confirm plugin action", fmt.Sprintf("Will execute:\n%s %s", p.Command, strings.Join(args, " ")), func() {
|
msg := fmt.Sprintf("Run?\n%s %s", p.Command, strings.Join(args, " "))
|
||||||
fn()
|
dialog.ShowConfirm(r.App().Content.Pages, "Confirm "+p.Description, msg, cb, func() {})
|
||||||
}, func() {})
|
return nil
|
||||||
} else {
|
|
||||||
fn()
|
|
||||||
}
|
}
|
||||||
|
cb()
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue