Skip to content

Commit fb807ee

Browse files
committed
more compact format
1 parent 9c83cc0 commit fb807ee

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

cmd/snapshot/snapshot_schedule_show.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package snapshot
22

33
import (
4+
"fmt"
45
"os"
56
"strconv"
67
"strings"
@@ -62,7 +63,7 @@ var snapshotScheduleShowCmd = &cobra.Command{
6263
case "custom":
6364
ow.WriteCustomOutput(common.OutputFields)
6465
default:
65-
ow.StartLine()
66+
ow := utility.NewOutputWriter()
6667
ow.AppendDataWithLabel("ID", utility.Green(schedule.ID), "ID")
6768
ow.AppendDataWithLabel("Name", utility.Green(schedule.Name), "Name")
6869
ow.AppendDataWithLabel("Description", schedule.Description, "Description")
@@ -79,17 +80,20 @@ var snapshotScheduleShowCmd = &cobra.Command{
7980
}
8081

8182
ow.AppendDataWithLabel("Instances", "", "Instances")
82-
for _, instance := range schedule.Instances {
83-
ow.AppendDataWithLabel(" ID", utility.Green(instance.ID), " ID")
83+
for i, instance := range schedule.Instances {
84+
k := fmt.Sprintf("Instance %d ID", i+1)
85+
ow.AppendDataWithLabel(k, utility.Green(instance.ID), k)
8486
if instance.Size != "" {
85-
ow.AppendDataWithLabel(" Size", instance.Size, " Size")
87+
k = fmt.Sprintf("Instance %d Size", i+1)
88+
ow.AppendDataWithLabel(k, instance.Size, k)
8689
}
8790
if len(instance.IncludedVolumes) > 0 {
88-
ow.AppendDataWithLabel(" Included Volumes", strings.Join(instance.IncludedVolumes, ", "), " Included Volumes")
91+
k = fmt.Sprintf("Instance %d Included Volumes", i+1)
92+
ow.AppendDataWithLabel(k, strings.Join(instance.IncludedVolumes, ", "), k)
8993
}
9094
}
9195

92-
ow.WriteTable()
96+
ow.WriteKeyValues()
9397
}
9498
},
9599
}

0 commit comments

Comments
 (0)