Skip to content

Commit

Permalink
✨ hide the children of pending and completed tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
acidjazz committed Feb 13, 2025
1 parent a8b279a commit 3a46a51
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 23 deletions.
44 changes: 21 additions & 23 deletions examples/multi/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,33 +33,31 @@ func main() {
},
},

/*
{
Title: "Pluck the polish and marans",
Tasks: taskin.Tasks{
{
Title: "Pluck the polish",
Task: func(t *taskin.Task) error {
for i := 0; i < 3; i++ {
t.Title = fmt.Sprintf(" [%d/3] polish plucked", i+1)
time.Sleep(500 * time.Millisecond)
}
return nil
},
{
Title: "Pluck the polish and marans",
Tasks: taskin.Tasks{
{
Title: "Pluck the polish",
Task: func(t *taskin.Task) error {
for i := 0; i < 3; i++ {
t.Title = fmt.Sprintf(" [%d/3] polish plucked", i+1)
time.Sleep(500 * time.Millisecond)
}
return nil
},
{
Title: "Pluck the marans",
Task: func(t *taskin.Task) error {
for i := 0; i < 3; i++ {
t.Title = fmt.Sprintf(" [%d/3] marans plucked", i+1)
time.Sleep(500 * time.Millisecond)
}
return nil
},
},
{
Title: "Pluck the marans",
Task: func(t *taskin.Task) error {
for i := 0; i < 3; i++ {
t.Title = fmt.Sprintf(" [%d/3] marans plucked", i+1)
time.Sleep(500 * time.Millisecond)
}
return nil
},
},
},
*/
},

{
Title: "Pluck the leghorns",
Expand Down
5 changes: 5 additions & 0 deletions mvc.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ func (m *Model) View() string {
view += lipgloss.NewStyle().Render(status) + "\n"

for _, child := range runner.Children {

// Only show children if parent is Running
if runner.State != Running {
continue
}
status = ""
switch child.State {
case NotStarted:
Expand Down

0 comments on commit 3a46a51

Please sign in to comment.