From b700881b43b0c64b1d0faf25b0747a5c7294fce3 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 13 Jan 2024 21:39:44 -0600 Subject: everything successfully in repostatus package code now uses 'hidden' widgets add go.* remvoe old code status is maybe done skips non-existent repos Signed-off-by: Jeff Carr Signed-off-by: Jeff Carr --- unix.go | 96 ----------------------------------------------------------------- 1 file changed, 96 deletions(-) delete mode 100644 unix.go (limited to 'unix.go') diff --git a/unix.go b/unix.go deleted file mode 100644 index 7c9f8db..0000000 --- a/unix.go +++ /dev/null @@ -1,96 +0,0 @@ -// This is a simple example -package main - -import ( - "os" - "os/exec" - "strings" - - "go.wit.com/log" - -// "go.wit.com/gui/gui" -// "go.wit.com/gui/gadgets" -// "go.wit.com/apps/control-panel-dns/smartwindow" -) - -func fullpath(repo string) string { - return "/home/jcarr/go/src/" + repo -} - -func run(path string, thing string, cmdline string) string { - parts := strings.Split(cmdline, " ") - // Create the command - cmd := exec.Command(thing, parts...) - - // Set the working directory - cmd.Dir = fullpath(path) - - // Execute the command - output, err := cmd.CombinedOutput() - if err != nil { - log.Error(err, "cmd error'd out", parts) - return "" - } - - tmp := string(output) - - tmp = strings.TrimSpace(tmp) - - // Print the output - log.Info("run()", path, thing, cmdline, "=", tmp) - return tmp -} - -func listFiles(directory string) []string { - var files []string - fileInfo, err := os.ReadDir(directory) - if err != nil { - log.Error(err) - return nil - } - - for _, file := range fileInfo { - if !file.IsDir() { - files = append(files, file.Name()) - } - } - - return files -} - -func runCmd(path string, cmdline string) (bool, string) { - parts := strings.Split(cmdline, " ") - if len(parts) == 0 { - log.Warn("command line was empty") - return false, "" - } - if parts[0] == "" { - log.Warn("command line was empty") - return false, "" - } - thing := parts[0] - parts = parts[1:] - - log.Warn("path =", path, "thing =", thing, "cmdline =", parts) - return false, "" - // Create the command - cmd := exec.Command(thing, parts...) - - // Set the working directory - cmd.Dir = fullpath(path) - - // Execute the command - output, err := cmd.CombinedOutput() - if err != nil { - log.Error(err) - log.Warn("output was", output) - log.Warn("cmd exited with error", err) - return false, string(output) - } - - tmp := string(output) - tmp = strings.TrimSpace(tmp) - - // Print the output - return true, tmp -} -- cgit v1.2.3