Stub out config sub-command

This commit is contained in:
Christian Rocha 2020-10-26 12:21:23 -04:00
parent 7ea7cc59e3
commit 7a700d2511
No known key found for this signature in database
GPG key ID: D6CC7A16E5878018
2 changed files with 27 additions and 0 deletions

25
config_cmd.go Normal file
View file

@ -0,0 +1,25 @@
package main
import (
"errors"
"fmt"
"os"
"github.com/charmbracelet/charm/ui/common"
"github.com/spf13/cobra"
)
var configCmd = &cobra.Command{
Use: "config",
Hidden: false,
Short: "Edit the glow config file",
Long: formatBlock(fmt.Sprintf("\n%s the glow config file. Well use EDITOR to determine which editor to use. If the config file doesn't exist, it will be created.", common.Keyword("Edit"))),
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
if os.Getenv("EDITORS") == "" {
return errors.New("no EDITOR environment variable set")
}
return nil
},
}

View file

@ -333,6 +333,8 @@ func init() {
stashCmd.PersistentFlags().StringVarP(&memo, "memo", "m", "", "memo/note for stashing")
rootCmd.AddCommand(stashCmd)
rootCmd.AddCommand(configCmd)
cobra.OnInitialize(initConfig)
}