add spinner to oizys

This commit is contained in:
Daylin Morgan 2024-05-06 12:11:05 -05:00
parent aa91eb9a8f
commit dca2c93a69
Signed by: daylin
GPG key ID: 950D13E9719334AD
4 changed files with 14 additions and 1 deletions

View file

@ -10,7 +10,7 @@ buildGoModule {
version = "unstable";
src = lib.cleanSource ./.;
vendorHash = "sha256-kh/7dV49KaQcD9ho8IpBcRc6+05bn4XpMzAI9JXu7+o=";
vendorHash = "sha256-Fcq8p/YItF5lx82PRg1/tksV7iCIS0xZZVWdpE3e7F0=";
nativeBuildInputs = [installShellFiles];

View file

@ -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

View file

@ -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=

View file

@ -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)
}