From 3d7011e504f6cfb6b000a7faed0edfced2b3c765 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ken-H=C3=A5vard=20Lieng?= Date: Fri, 1 May 2020 04:31:20 +0200 Subject: [PATCH] Add vscode to config command editor stack and enable passing in an arbitrary editor --- commands/config.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/commands/config.go b/commands/config.go index 7772e29c..5d0d70eb 100644 --- a/commands/config.go +++ b/commands/config.go @@ -12,9 +12,11 @@ import ( var ( configCmd = &cobra.Command{ - Use: "config", + Use: "config [editor]", Short: "Edit config file", Run: func(cmd *cobra.Command, args []string) { + editors = append(args, editors...) + if editor := findEditor(); editor != "" { process := exec.Command(editor, storage.Path.Config()) 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 {