diff options
| author | Stefan Majewsky <majewsky@gmx.net> | 2017-05-02 20:37:39 +0200 |
|---|---|---|
| committer | Stefan Majewsky <majewsky@gmx.net> | 2017-05-02 20:37:39 +0200 |
| commit | 6b382c55ed7885857a6232a0c8b086ab1f64985e (patch) | |
| tree | 7a7bda45f42ab4040e4a4104a0cc5157e984204b /repo.go | |
| parent | ba69181d4d892aecfc35f9f30fe190d946662284 (diff) | |
| download | gofu-6b382c55ed7885857a6232a0c8b086ab1f64985e.tar.gz | |
move code out of main.go into the model types
Diffstat (limited to 'repo.go')
| -rw-r--r-- | repo.go | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -178,3 +178,19 @@ func (r Repo) Checkout() error { return nil } + +//InteractiveExec implements the meat of the `rtree exec` command. It returns +//true iff the command exited successfully. +func (r Repo) InteractiveExec(command string, args ...string) (ok bool) { + fmt.Fprintf(os.Stdout, "\x1B[1;36m>> \x1B[0;36m%s\x1B[0m\n", r.AbsolutePath()) + cmd := exec.Command(command, args...) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + cmd.Dir = r.AbsolutePath() + err := cmd.Run() + if err != nil { + fmt.Fprintf(os.Stderr, "\x1B[1;31m!! \x1B[0;31m%s\x1B[0m\n", err.Error()) + return false + } + return true +} |
