Skip to content

Commit

Permalink
✨ modified the view to only paint when alldone for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
acidjazz committed May 6, 2024
1 parent e270dbe commit 96d5db5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
21 changes: 21 additions & 0 deletions mvc.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,29 @@ func (r *Runners) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return r, nil
}

func (r *Runners) checkTasksState() (allDone, anyFailed bool) {
allDone = true
for _, runner := range *r {
if runner.State != Completed && runner.State != Failed {
allDone = false
}
if runner.State == Failed {
anyFailed = true
}
}
return
}

func (r *Runners) View() string {
var view string

// check if CI is set, if it is then don't return the view until all tasks are completed or one has failed
if os.Getenv("CI") != "" {
allDone, _ := r.checkTasksState()
if !allDone {
return ""
}
}
for _, runner := range *r {
status := ""
switch runner.State {
Expand Down
1 change: 0 additions & 1 deletion taskin.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ func New(tasks Tasks, cfg Config) Runners {

for _, runner := range runners[:i] {
if runner.State == Failed {
program.Send(spinner.TickMsg{})
return
}
}
Expand Down

0 comments on commit 96d5db5

Please sign in to comment.