From 00e3781049966079369d8ded2b6f2e2d2d55d237 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Thu, 20 Jun 2024 13:41:18 -0500 Subject: [PATCH] oizys-go QOL --- pkgs/oizys/oizys-go/cmd/root.go | 2 +- pkgs/oizys/oizys-go/internal/oizys/main.go | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pkgs/oizys/oizys-go/cmd/root.go b/pkgs/oizys/oizys-go/cmd/root.go index d66df90..e447773 100644 --- a/pkgs/oizys/oizys-go/cmd/root.go +++ b/pkgs/oizys/oizys-go/cmd/root.go @@ -55,7 +55,7 @@ func setupLogger() { log.SetReportTimestamp(false) styles := log.DefaultStyles() for k, v := range styles.Levels { - styles.Levels[k] = v.MaxWidth(10) + styles.Levels[k] = v.Width(5).MaxWidth(5) } log.SetStyles(styles) } diff --git a/pkgs/oizys/oizys-go/internal/oizys/main.go b/pkgs/oizys/oizys-go/internal/oizys/main.go index a13d48b..e71b443 100644 --- a/pkgs/oizys/oizys-go/internal/oizys/main.go +++ b/pkgs/oizys/oizys-go/internal/oizys/main.go @@ -190,6 +190,7 @@ func (p *packages) summary() { Render(fmt.Sprint(len(p.names))), ) } + func logCmd(cmd *exec.Cmd) { log.Debugf("CMD: %s", strings.Join(cmd.Args, " ")) } @@ -237,9 +238,13 @@ func parseDryRun(buf string) (*packages, *packages) { var parts [2][]string i := 0 for _, line := range lines { - if strings.Contains(line, "fetch") { + if strings.Contains(line, "fetch") && strings.HasSuffix(line, ":") { i++ } + if i == 2 { + log.Fatal("failed to parse output", "output", buf) + } + if strings.HasPrefix(line, " ") { parts[i] = append(parts[i], line) } @@ -247,7 +252,7 @@ func parseDryRun(buf string) (*packages, *packages) { if len(parts[0])+len(parts[1]) == 0 { log.Info("no changes...") - log.Fatal("or failed to parse nix build --dry-run output") + os.Exit(0) } return parsePackages(parts[0], "packages to build"),