Option to use text editor instead of multiline prompts #424

Closed
opened 2021-09-29 11:09:23 +00:00 by noerw · 0 comments
Member

our survey dependency actually has builtin support for this, so when we implement this, we may be able to drop our own routines for starting a texteditor (

// OpenFileInEditor opens filename in a text editor, and blocks until the editor terminates.
func OpenFileInEditor(filename string) error {
editor := os.Getenv("VISUAL")
if editor == "" {
editor = os.Getenv("EDITOR")
if editor == "" {
fmt.Println("No $VISUAL or $EDITOR env is set, defaulting to vim")
editor = "vi"
}
}
// Get the full executable path for the editor.
executable, err := exec.LookPath(editor)
if err != nil {
return err
}
cmd := exec.Command(executable, filename)
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
return cmd.Run()
}
)

I'd make this optional through a config option prefer_external_editor: true or something like that.

our survey dependency actually [has builtin support for this](https://github.com/AlecAivazis/survey/#editor), so when we implement this, we may be able to drop our own routines for starting a texteditor (https://gitea.com/gitea/tea/src/commit/7a05be436c0a494bcb3c3edd4461496e7efa63ec/modules/task/pull_review.go#L108-L131 ) I'd make this optional through a config option `prefer_external_editor: true` or something like that.
noerw added the
kind
feature
label 2021-09-29 11:09:23 +00:00
noerw added this to the v0.9.0 milestone 2021-10-03 10:51:57 +00:00
lunny closed this issue 2021-10-14 14:36:09 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: gitea/tea#424
No description provided.