From 12c45e5a1c5380bcc7e9c00b5b4ba8c82e100eab Mon Sep 17 00:00:00 2001 From: codeskyblue Date: Thu, 23 Mar 2017 10:14:51 +0800 Subject: [PATCH] add gosuv edit command --- gosuv.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/gosuv.go b/gosuv.go index eb2b272..f28f332 100644 --- a/gosuv.go +++ b/gosuv.go @@ -203,6 +203,14 @@ func actionUpdateSelf(c *cli.Context) error { return equinoxUpdate(c.String("channel"), c.Bool("yes")) } +func actionEdit(c *cli.Context) error { + cmd := exec.Command("vim", filepath.Join(os.Getenv("HOME"), ".gosuv/programs.yml")) + cmd.Stdout = os.Stdout + cmd.Stdin = os.Stdin + cmd.Stderr = os.Stderr + return cmd.Run() +} + func actionVersion(c *cli.Context) error { fmt.Printf("gosuv version %s\n", Version) return nil @@ -298,6 +306,11 @@ func main() { }, Action: actionUpdateSelf, }, + { + Name: "edit", + Usage: "Edit config file", + Action: actionEdit, + }, { Name: "version", Usage: "Show version",