File tree Expand file tree Collapse file tree 6 files changed +19
-1
lines changed
Expand file tree Collapse file tree 6 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,8 @@ type authSuccessMsg struct {
8888 cred auth.Credential
8989}
9090
91+ func (loginModel ) NeedsRenderer () {}
92+
9193type loginModel struct {
9294 baseModel
9395
Original file line number Diff line number Diff line change @@ -148,6 +148,8 @@ func (s installState) String() string {
148148 }
149149}
150150
151+ func (progressiveInstallModel ) NeedsRenderer () {}
152+
151153type progressiveInstallModel struct {
152154 baseModel
153155
Original file line number Diff line number Diff line change @@ -59,6 +59,13 @@ type HasStatus interface {
5959 Err () error
6060}
6161
62+ // NeedsRenderer is implemented by models that render a live TUI (spinners,
63+ // progress bars, interactive lists). Models that only use tea.Println /
64+ // tea.Printf and return an empty View do not need the renderer.
65+ type NeedsRenderer interface {
66+ NeedsRenderer ()
67+ }
68+
6269// use this so we can override this in tests
6370var getDriverRegistry = dbc .GetDriverList
6471
@@ -218,7 +225,8 @@ func main() {
218225 // }
219226 // defer f.Close()
220227
221- if ! isatty .IsTerminal (os .Stdout .Fd ()) {
228+ _ , needsRenderer := m .(NeedsRenderer )
229+ if ! isatty .IsTerminal (os .Stdout .Fd ()) || ! needsRenderer {
222230 prog = tea .NewProgram (m , tea .WithoutRenderer (), tea .WithInput (nil ))
223231 } else if args .Quiet {
224232 // Quiet still prints stderr as GNU standard is to suppress "usual" output
Original file line number Diff line number Diff line change @@ -64,6 +64,8 @@ func (c SyncCmd) GetModel() tea.Model {
6464 }
6565}
6666
67+ func (syncModel ) NeedsRenderer () {}
68+
6769type syncModel struct {
6870 baseModel
6971
Original file line number Diff line number Diff line change @@ -42,6 +42,8 @@ func (i item) Title() string { return i.d.Title }
4242func (i item ) Description () string { return i .d .Desc }
4343func (i item ) FilterValue () string { return i .d .Title }
4444
45+ func (model ) NeedsRenderer () {}
46+
4547type model struct {
4648 Prev tea.Model
4749
Original file line number Diff line number Diff line change @@ -46,6 +46,8 @@ func getTuiModel() tea.Model {
4646 return m
4747}
4848
49+ func (menu ) NeedsRenderer () {}
50+
4951type menu struct {
5052 options list.Model
5153}
You can’t perform that action at this time.
0 commit comments