Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pkg/cmd/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,12 @@ func runPreview(ctx context.Context, cmd *cli.Command) error {
if !cmd.Bool("watch") {
break
}

// Clear the screen and move the cursor to the top
fmt.Print("\nRebuilding...\n\n\033[2J\033[H")
os.Stdout.Sync()
Property("branch", selectedBranch)
Property("targets", strings.Join(selectedTargets, ", "))
}
return nil
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/cmd/dev_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ var parts = []struct {
},
},
{
name: "diagnostics",
name: "build diagnostics",
view: func(m BuildModel, s *strings.Builder) {
if m.diagnostics == nil {
s.WriteString(SProperty(0, "diagnostics", "waiting for build to finish"))
s.WriteString(SProperty(0, "build diagnostics", "(waiting for build to finish)"))
} else {
s.WriteString(ViewDiagnosticsPrint(m.diagnostics, 10))
}
Expand Down Expand Up @@ -362,15 +362,15 @@ func ViewDiagnosticsPrint(diagnostics []stainless.BuildDiagnostic, maxDiagnostic
}
}

s.WriteString(SProperty(0, "diagnostics", summary))
s.WriteString(SProperty(0, "build diagnostics", summary))
s.WriteString(lipgloss.NewStyle().
Padding(0).
Border(lipgloss.RoundedBorder()).
BorderForeground(lipgloss.Color("208")).
Render(strings.TrimRight(sub.String(), "\n")),
)
} else {
s.WriteString(SProperty(0, "diagnostics", "(no errors or warnings)"))
s.WriteString(SProperty(0, "build diagnostics", "(no errors or warnings)"))
}

return s.String()
Expand Down
12 changes: 10 additions & 2 deletions pkg/cmd/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ type lintModel struct {
diagnostics []stainless.BuildDiagnostic
error error
watching bool
skipped bool
canSkip bool
ctx context.Context
cmd *cli.Command
Expand All @@ -77,6 +78,7 @@ func (m lintModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return m, tea.Quit
} else if msg.String() == "enter" {
m.watching = false
m.skipped = true
return m, tea.Quit
}

Expand Down Expand Up @@ -124,10 +126,16 @@ func (m lintModel) View() string {
if m.error != nil {
content = "Linting failed!"
} else if m.diagnostics == nil {
content = m.spinner.View() + " Linting"
if m.skipped {
content = "Skipped!"
} else {
content = m.spinner.View() + " Linting"
}
} else {
content = ViewDiagnosticsPrint(m.diagnostics, -1)
if m.watching {
if m.skipped {
content += "\nContinuing..."
} else if m.watching {
content += "\n" + m.spinner.View() + " Waiting for configuration changes"
}
}
Expand Down