mirror of
https://github.com/charmbracelet/glow
synced 2024-10-02 22:23:33 +00:00
Check for $EDITOR before writing the file
This commit is contained in:
parent
4b4fb783d2
commit
858beaf143
|
@ -27,6 +27,11 @@ var configCmd = &cobra.Command{
|
|||
Example: formatBlock("glow config\nglow config --config path/to/config.yml"),
|
||||
Args: cobra.NoArgs,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
editor := os.Getenv("EDITOR")
|
||||
if editor == "" {
|
||||
return errors.New("no EDITOR environment variable set")
|
||||
}
|
||||
|
||||
if configFile == "" {
|
||||
scope := gap.NewScope(gap.User, "glow")
|
||||
|
||||
|
@ -61,11 +66,6 @@ var configCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
|
||||
editor := os.Getenv("EDITOR")
|
||||
if editor == "" {
|
||||
return errors.New("no EDITOR environment variable set")
|
||||
}
|
||||
|
||||
c := exec.Command(editor, configFile)
|
||||
c.Stdin = os.Stdin
|
||||
c.Stdout = os.Stdout
|
||||
|
|
Loading…
Reference in a new issue