Add vscode to config command editor stack and enable passing in an arbitrary editor
This commit is contained in:
parent
3d2e443108
commit
3d7011e504
@ -12,9 +12,11 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
configCmd = &cobra.Command{
|
configCmd = &cobra.Command{
|
||||||
Use: "config",
|
Use: "config [editor]",
|
||||||
Short: "Edit config file",
|
Short: "Edit config file",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
editors = append(args, editors...)
|
||||||
|
|
||||||
if editor := findEditor(); editor != "" {
|
if editor := findEditor(); editor != "" {
|
||||||
process := exec.Command(editor, storage.Path.Config())
|
process := exec.Command(editor, storage.Path.Config())
|
||||||
process.Stdin = os.Stdin
|
process.Stdin = os.Stdin
|
||||||
@ -27,7 +29,7 @@ var (
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
editors = []string{"nano", "notepad", "vi", "emacs"}
|
editors = []string{"nano", "code", "vi", "emacs", "notepad"}
|
||||||
)
|
)
|
||||||
|
|
||||||
func findEditor() string {
|
func findEditor() string {
|
||||||
|
Loading…
Reference in New Issue
Block a user