summaryrefslogtreecommitdiff
path: root/repo.go
diff options
context:
space:
mode:
Diffstat (limited to 'repo.go')
-rw-r--r--repo.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/repo.go b/repo.go
index f0c2491..532b5d1 100644
--- a/repo.go
+++ b/repo.go
@@ -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
+}