From 75eaee2adc2948a08334376b81dbf0274e4b3711 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Tue, 13 Mar 2018 04:21:05 +0100 Subject: [PATCH] Update description when picking an executable --- createcmd.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/createcmd.go b/createcmd.go index e0c3b9b..15134fd 100644 --- a/createcmd.go +++ b/createcmd.go @@ -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 }).