From b8cd094ca8f7a3cf3ab77a1e69f94eaae6403626 Mon Sep 17 00:00:00 2001 From: Andy Feller Date: Thu, 10 Apr 2025 18:11:38 -0400 Subject: [PATCH] Ensure markdown confirm prompt shows editor name Apparently, `gh` might not actually have an editor at the time we're prompting the user if they want to use it for markdown editing. In the survey package, there is a function that will handle fallback to the default editor based on environment variables and parse it in the case the editor contains flags and arguments for cases like Visual Studio Code. Additionally, there are no tests for the EditorName function and the fact it is loaded via `init` makes this difficult to test. Co-authored-by: Kynan Ware <47394200+BagToad@users.noreply.github.com> --- internal/prompter/prompter.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/prompter/prompter.go b/internal/prompter/prompter.go index 7dd45bf5c..cd53d7199 100644 --- a/internal/prompter/prompter.go +++ b/internal/prompter/prompter.go @@ -234,9 +234,9 @@ func (p *accessiblePrompter) InputHostname() (string, error) { func (p *accessiblePrompter) MarkdownEditor(prompt, defaultValue string, blankAllowed bool) (string, error) { var result string skipOption := "skip" - openOption := "open" + launchOption := "launch" options := []huh.Option[string]{ - huh.NewOption(fmt.Sprintf("Open Editor: %s", p.editorCmd), openOption), + huh.NewOption(fmt.Sprintf("Launch %s", surveyext.EditorName(p.editorCmd)), launchOption), } if blankAllowed { options = append(options, huh.NewOption("Skip", skipOption))