mirror of
https://github.com/gopasspw/gopass.git
synced 2025-12-08 19:24:54 +00:00
33 lines
629 B
Go
33 lines
629 B
Go
//go:build !linux && !windows
|
|
|
|
package editor
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/gopasspw/gopass/internal/config"
|
|
"github.com/urfave/cli/v2"
|
|
)
|
|
|
|
// Path return the name/path of the preferred editor.
|
|
func Path(c *cli.Context) string {
|
|
if c != nil {
|
|
if ed := c.String("editor"); ed != "" {
|
|
return ed
|
|
}
|
|
}
|
|
|
|
if ed := config.String(c.Context, "edit.editor"); ed != "" {
|
|
return ed
|
|
}
|
|
|
|
if ed := os.Getenv("EDITOR"); ed != "" {
|
|
return ed
|
|
}
|
|
|
|
// given, this is a very opinionated default, but this should be available
|
|
// on virtually any UNIX system and the user can still set EDITOR to get
|
|
// his favorite one
|
|
return "vi"
|
|
}
|