From 4148c1408564d2353a43d78dcc9aab0d480a38fd Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Fri, 26 Dec 2014 19:30:53 -0500 Subject: git-checkout-store: Take arbitrary arguments Allow arbitrary arguments to be inputted. This allows us to take flags and pass them on directly to `git-checkout`. We can now for example do git checkout-store -b some-new-branch and the command will work the same way as `git-checkout` with the added benefit of storing the branch in history. --- git-checkout-store/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'git-checkout-store/main.go') diff --git a/git-checkout-store/main.go b/git-checkout-store/main.go index 3fd82f3..085a4a0 100644 --- a/git-checkout-store/main.go +++ b/git-checkout-store/main.go @@ -12,9 +12,9 @@ func main() { args := os.Args[1:] if len(args) > 0 { - utils.Store(args[0]) + utils.Store(args[len(args) - 1]) - cmd := exec.Command("git", "checkout", args[0]) + cmd := exec.Command("git", append([]string{"checkout"}, args...)...) var out bytes.Buffer cmd.Stderr = &out err := cmd.Run() -- cgit v1.2.3