summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common.go26
-rw-r--r--unix.go29
2 files changed, 55 insertions, 0 deletions
diff --git a/common.go b/common.go
index 31c2e37..bc518be 100644
--- a/common.go
+++ b/common.go
@@ -82,3 +82,29 @@ func (rs *RepoStatus) RepoType() string {
log.Info("package is: unknown", err)
return ""
}
+
+func (rs *RepoStatus) BinaryName() string {
+ // get the package name from the repo name
+ path := rs.String()
+ parts := strings.Split(path, "/")
+ name := parts[len(parts)-1]
+ return name
+}
+
+func (rs *RepoStatus) Build() bool {
+ name := rs.BinaryName()
+ // removes the binary if it already exists
+ rs.RunCmd([]string{"rm", "-f", name})
+ if rs.Exists(name) {
+ log.Warn("file could not be removed filename =", name)
+ return false
+ }
+ log.Info("need to build here", rs.String())
+ rs.RunCmd([]string{"go", "build", "-v", "-x"})
+ if rs.Exists(name) {
+ log.Warn("build worked", name)
+ return true
+ }
+ log.Warn("build failed", name)
+ return false
+}
diff --git a/unix.go b/unix.go
index ce89c92..1c8cfe0 100644
--- a/unix.go
+++ b/unix.go
@@ -382,3 +382,32 @@ func (rs *RepoStatus) Xterm(args []string) {
log.Info("cmd = xterm", argsX)
}
}
+
+func (rs *RepoStatus) XtermHold(args []string) {
+ var argsX = []string{"-hold", "-geometry", "120x40"}
+ /*
+ if xtermHold.Checked() {
+ log.Println("hold = true")
+ argsXterm = append(argsXterm, "-hold")
+ } else {
+ log.Println("hold = false")
+ }
+ */
+ argsX = append(argsX, "-e", "bash", "-c")
+ argsX = append(argsX, args...)
+ log.Info("xterm cmd=", argsX)
+ // set less to not exit on small diff's
+ os.Setenv("LESS", "-+F -+X -R")
+ cmd := exec.Command("xterm", argsX...)
+ path := rs.realPath.String()
+ cmd.Dir = path
+ if err := cmd.Run(); err != nil {
+ log.Info("xterm.Run() failed")
+ log.Info("path =", path)
+ log.Info("cmd = xterm", argsX)
+ } else {
+ log.Info("xterm.Run() worked")
+ log.Info("path =", path)
+ log.Info("cmd = xterm", argsX)
+ }
+}