From 5cf065714b672445ff4f28649f8cb2ea12c2f17c Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 6 Dec 2014 11:45:30 -0500 Subject: git-checkout-store: Run `git checkout` with argument If an argument is passed in, run `git checkout` using that first argument to the program. Currently doesn't accept flags from git-checkout or send output from git-checkout. Ideally both of those would be supported. --- git-checkout-store/main.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'git-checkout-store/main.go') diff --git a/git-checkout-store/main.go b/git-checkout-store/main.go index d02f8ad..359c4db 100644 --- a/git-checkout-store/main.go +++ b/git-checkout-store/main.go @@ -3,11 +3,19 @@ package main import ( "os" + "os/exec" "fmt" ) func main() { args := os.Args[1:] - fmt.Println(args) + + if len(args) > 0 { + cmd := exec.Command("git", "checkout", args[0]) + err := cmd.Run() + if err != nil { + fmt.Fprintf(os.Stderr, err.Error()) + } + } } -- cgit v1.2.3