a06f331eb8
CI / benchmark (push) Has been skipped
install-script / posix-syntax (push) Successful in 6m1s
CI / build-onnx (push) Failing after 6m43s
init-smoke / dry-run (push) Failing after 15m57s
security / govulncheck (push) Has been cancelled
security / trivy-fs (push) Has been cancelled
CI / test (1.26, ubuntu-latest) (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
CI / test (1.26, macos-latest) (push) Has been cancelled
CI / build-windows (push) Has been cancelled
CI / lint (push) Has been cancelled
install-script / powershell-syntax (push) Has been cancelled
install-script / install (macos-14) (push) Has been cancelled
install-script / install (ubuntu-latest) (push) Has been cancelled
39 lines
868 B
Go
39 lines
868 B
Go
package main
|
|
|
|
import (
|
|
"time"
|
|
|
|
tea "github.com/charmbracelet/bubbletea"
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/zzet/gortex/internal/progress"
|
|
)
|
|
|
|
// runDaemonStatusWatch launches the bubbletea-driven status TUI on a TTY.
|
|
// Falls back to a single static render on a pipe / when --no-progress is set.
|
|
func runDaemonStatusWatch(cmd *cobra.Command) error {
|
|
w := cmd.OutOrStdout()
|
|
if !progress.IsTTY(w) || noProgress {
|
|
st, err := fetchDaemonStatusForCLI()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
renderDaemonHeader(w, st)
|
|
renderDaemonWorkspaces(w, st)
|
|
renderDaemonRepos(w, st)
|
|
renderDaemonSessions(w, st)
|
|
renderDaemonServers(w, st)
|
|
return nil
|
|
}
|
|
|
|
interval := max(daemonStatusInterval, 500*time.Millisecond)
|
|
model := newStatusTUI(interval)
|
|
prog := tea.NewProgram(
|
|
model,
|
|
tea.WithOutput(w),
|
|
tea.WithAltScreen(),
|
|
)
|
|
_, err := prog.Run()
|
|
return err
|
|
}
|