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>
This commit is contained in:
parent
20ff409bfc
commit
b8cd094ca8
1 changed files with 2 additions and 2 deletions
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue