Skip to content

Commit f84401c

Browse files
authored
Simple waiting feedback for leo (#711)
* basic waiting bar for --follow while still setting up the instance * no extra newlines * p stderr
1 parent ac7bd20 commit f84401c

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

cmd/leo/read/read.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ func (o *Options) Run(cmd *cobra.Command, args []string, cloud *common.Cloud) er
6868
return err
6969
}
7070

71-
var last int
71+
var last int
72+
firstRun := true
73+
waiting := false
7274
for {
7375
if err := tsk.Read(ctx); err != nil {
7476
return err
@@ -79,12 +81,25 @@ func (o *Options) Run(cmd *cobra.Command, args []string, cloud *common.Cloud) er
7981
return err
8082
}
8183

84+
if firstRun && len(logs) == 0 {
85+
fmt.Fprint(os.Stderr, "Waiting for instance")
86+
waiting = true
87+
}
88+
firstRun = false
89+
if waiting {
90+
fmt.Fprint(os.Stderr, ".")
91+
}
92+
8293
status, err := o.getStatus(ctx, tsk)
8394
if err != nil {
8495
return err
8596
}
8697

8798
if delta := strings.Join(logs[last:], "\n"); delta != "" {
99+
if waiting {
100+
fmt.Fprint(os.Stderr, "\n")
101+
waiting = false
102+
}
88103
fmt.Println(delta)
89104
last = len(logs)
90105
}

0 commit comments

Comments
 (0)