From dca2c93a692f81d41bee05b909f482364f7535b6 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Mon, 6 May 2024 12:11:05 -0500 Subject: [PATCH] add spinner to oizys --- pkgs/oizys/oizys-go/default.nix | 2 +- pkgs/oizys/oizys-go/go.mod | 1 + pkgs/oizys/oizys-go/go.sum | 2 ++ pkgs/oizys/oizys-go/pkg/oizys/oizys.go | 10 ++++++++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/pkgs/oizys/oizys-go/default.nix b/pkgs/oizys/oizys-go/default.nix index 1cc1e98..886acf8 100644 --- a/pkgs/oizys/oizys-go/default.nix +++ b/pkgs/oizys/oizys-go/default.nix @@ -10,7 +10,7 @@ buildGoModule { version = "unstable"; src = lib.cleanSource ./.; - vendorHash = "sha256-kh/7dV49KaQcD9ho8IpBcRc6+05bn4XpMzAI9JXu7+o="; + vendorHash = "sha256-Fcq8p/YItF5lx82PRg1/tksV7iCIS0xZZVWdpE3e7F0="; nativeBuildInputs = [installShellFiles]; diff --git a/pkgs/oizys/oizys-go/go.mod b/pkgs/oizys/oizys-go/go.mod index b9efd5e..727be12 100644 --- a/pkgs/oizys/oizys-go/go.mod +++ b/pkgs/oizys/oizys-go/go.mod @@ -13,6 +13,7 @@ require ( require ( github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect + github.com/briandowns/spinner v1.23.0 // indirect github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect github.com/fatih/color v1.16.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect diff --git a/pkgs/oizys/oizys-go/go.sum b/pkgs/oizys/oizys-go/go.sum index c30047b..a47b955 100644 --- a/pkgs/oizys/oizys-go/go.sum +++ b/pkgs/oizys/oizys-go/go.sum @@ -1,5 +1,7 @@ github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= +github.com/briandowns/spinner v1.23.0 h1:alDF2guRWqa/FOZZYWjlMIx2L6H0wyewPxo/CH4Pt2A= +github.com/briandowns/spinner v1.23.0/go.mod h1:rPG4gmXeN3wQV/TsAY4w8lPdIM6RX3yqeBQJSrbXjuE= github.com/charmbracelet/bubbles v0.18.0 h1:PYv1A036luoBGroX6VWjQIE9Syf2Wby2oOl/39KLfy0= github.com/charmbracelet/bubbles v0.18.0/go.mod h1:08qhZhtIwzgrtBjAcJnij1t1H0ZRjwHyGsy6AL11PSw= github.com/charmbracelet/bubbletea v0.26.1 h1:xujcQeF73rh4jwu3+zhfQsvV18x+7zIjlw7/CYbzGJ0= diff --git a/pkgs/oizys/oizys-go/pkg/oizys/oizys.go b/pkgs/oizys/oizys-go/pkg/oizys/oizys.go index d905f80..160742d 100644 --- a/pkgs/oizys/oizys-go/pkg/oizys/oizys.go +++ b/pkgs/oizys/oizys-go/pkg/oizys/oizys.go @@ -12,6 +12,9 @@ import ( "github.com/charmbracelet/bubbles/table" "github.com/muesli/termenv" "golang.org/x/term" + + "github.com/briandowns/spinner" + "time" ) func TerminalSize() (int, int) { @@ -65,7 +68,14 @@ func ParseDryRunOutput(nixOutput string) { func NixDryRun(path string) { cmd := exec.Command("nix", "build", path, "--dry-run") + s := spinner.New( + spinner.CharSets[14], + 100*time.Millisecond, + spinner.WithSuffix(" evaluating derivation for: "+path), + spinner.WithColor("fgHiMagenta")) + s.Start() output, err := cmd.CombinedOutput() + s.Stop() if err != nil { log.Fatal(err) }