diff options
| author | Teddy Wing | 2014-12-06 12:12:07 -0500 | 
|---|---|---|
| committer | Teddy Wing | 2014-12-06 12:12:07 -0500 | 
| commit | c493950671962631eb87373388dd3fe3257cf4f7 (patch) | |
| tree | 34cdd486418a7275c4bae0ad5540968ff1c5a13a | |
| parent | 5cf065714b672445ff4f28649f8cb2ea12c2f17c (diff) | |
| download | git-checkout-history-c493950671962631eb87373388dd3fe3257cf4f7.tar.bz2 | |
git-checkout-store: Try to output STDOUT from git-checkout
Not working. What I want is to output `Switched to branch 'a-branch'`
from git-checkout.
Using the example from: http://golang.org/pkg/os/exec/#Command
| -rw-r--r-- | git-checkout-store/main.go | 4 | 
1 files changed, 4 insertions, 0 deletions
| diff --git a/git-checkout-store/main.go b/git-checkout-store/main.go index 359c4db..c9943e4 100644 --- a/git-checkout-store/main.go +++ b/git-checkout-store/main.go @@ -2,6 +2,7 @@ package main  import ( +	"bytes"  	"os"  	"os/exec"  	"fmt" @@ -13,9 +14,12 @@ func main() {  	if len(args) > 0 {  		cmd := exec.Command("git", "checkout", args[0]) +		var out bytes.Buffer +		cmd.Stdout = &out  		err := cmd.Run()  		if err != nil {  			fmt.Fprintf(os.Stderr, err.Error())  		} +		fmt.Println(out.String())  	}  } | 
