mirror of
https://github.com/rwinkhart/MUTN.git
synced 2026-09-05 16:47:20 -04:00
Better detect if fallback editor needs to be used
This commit is contained in:
+1
-1
@@ -17,7 +17,7 @@ func TempInitCli() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// textEditor
|
// textEditor
|
||||||
textEditor := input("Text editor (leave blank for $EDITOR, falls back to \"vi\"):")
|
textEditor := input("Text editor (leave blank for $EDITOR, falls back to \"" + offline.FallbackEditor + "\"):")
|
||||||
|
|
||||||
offline.TempInit(map[string]string{"textEditor": textEditor, "gpgID": gpgID})
|
offline.TempInit(map[string]string{"textEditor": textEditor, "gpgID": gpgID})
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -16,9 +16,9 @@ func TempInit(configFileMap map[string]string) {
|
|||||||
|
|
||||||
// ensure textEditor is set
|
// ensure textEditor is set
|
||||||
if configFileMap["textEditor"] == "" {
|
if configFileMap["textEditor"] == "" {
|
||||||
textEditor := os.Getenv("EDITOR")
|
textEditor, editorEnvPresent := os.LookupEnv("EDITOR")
|
||||||
if textEditor == "" {
|
if !editorEnvPresent {
|
||||||
textEditor = fallbackEditor
|
textEditor = FallbackEditor
|
||||||
}
|
}
|
||||||
configFileMap["textEditor"] = textEditor
|
configFileMap["textEditor"] = textEditor
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
const fallbackEditor = "vi" // vi is pre-installed on most UNIX systems
|
const FallbackEditor = "vi" // vi is pre-installed on most UNIX systems
|
||||||
|
|
||||||
// dirInit creates the libmutton directories
|
// dirInit creates the libmutton directories
|
||||||
func dirInit() {
|
func dirInit() {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
const fallbackEditor = "nvim" // since there is no pre-installed CLI editor on Windows, default to the most popular one
|
const FallbackEditor = "nvim" // since there is no pre-installed CLI editor on Windows, default to the most popular one
|
||||||
|
|
||||||
// dirInit creates the libmutton directories
|
// dirInit creates the libmutton directories
|
||||||
func dirInit() {
|
func dirInit() {
|
||||||
|
|||||||
Reference in New Issue
Block a user