From 4c5c08bfc45147f14481752a818f9270e26f77ea Mon Sep 17 00:00:00 2001 From: Kamontat Chantrachirathumrong Date: Wed, 6 Jun 2018 11:58:56 +0700 Subject: [PATCH] [Editor] Improve editor prompt (#140) * [Editor] Improve editor prompt Add support 'Editor' variable for input custom editor cli * Update editor.go * Update comment --- editor.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/editor.go b/editor.go index 84ef243c..27341b62 100644 --- a/editor.go +++ b/editor.go @@ -29,6 +29,7 @@ type Editor struct { Message string Default string Help string + Editor string HideDefault bool AppendDefault bool } @@ -143,6 +144,11 @@ func (e *Editor) Prompt() (interface{}, error) { return "", err } + // check is input editor exist + if e.Editor != "" { + editor = e.Editor + } + // open the editor cmd := exec.Command(editor, f.Name()) cmd.Stdin = os.Stdin