mirror of
https://github.com/charmbracelet/glow
synced 2025-01-18 23:14:00 +00:00
Stub out config sub-command
This commit is contained in:
parent
7ea7cc59e3
commit
7a700d2511
2 changed files with 27 additions and 0 deletions
25
config_cmd.go
Normal file
25
config_cmd.go
Normal 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. We’ll 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
|
||||
},
|
||||
}
|
2
main.go
2
main.go
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue