Update description when picking an executable

This commit is contained in:
Christian Muehlhaeuser 2018-03-13 04:21:05 +01:00
parent 5188ff0589
commit 75eaee2adc
1 changed files with 13 additions and 3 deletions

View File

@ -82,16 +82,26 @@ var (
return executeCreate()
}
app := tview.NewApplication()
form := tview.NewForm().
AddInputField("Description:", createOpts.Description, 40, nil, func(s string) {
form := tview.NewForm()
descriptionField := tview.NewInputField().
SetLabel("Description:").
SetText(createOpts.Description).
SetFieldWidth(40).
SetAcceptanceFunc(nil).
SetChangedFunc(func(s string) {
createOpts.Description = s
}).
})
form.
AddDropDown("Type:", types, types.IndexOf(createOpts.Type), func(s string, i int) {
createOpts.Type = s
}).
AddInputField("Exec on start:", createOpts.Exec, 40, nil, func(s string) {
createOpts.Exec = s
descriptionField.SetText(fmt.Sprintf("%s service", filepath.Base(createOpts.Exec)))
}).
AddFormItem(descriptionField).
AddInputField("Exec on stop:", createOpts.ExecStop, 40, nil, func(s string) {
createOpts.ExecStop = s
}).