1
1
package snapshot
2
2
3
3
import (
4
+ "fmt"
4
5
"os"
5
6
"strconv"
6
7
"strings"
@@ -62,7 +63,7 @@ var snapshotScheduleShowCmd = &cobra.Command{
62
63
case "custom" :
63
64
ow .WriteCustomOutput (common .OutputFields )
64
65
default :
65
- ow . StartLine ()
66
+ ow := utility . NewOutputWriter ()
66
67
ow .AppendDataWithLabel ("ID" , utility .Green (schedule .ID ), "ID" )
67
68
ow .AppendDataWithLabel ("Name" , utility .Green (schedule .Name ), "Name" )
68
69
ow .AppendDataWithLabel ("Description" , schedule .Description , "Description" )
@@ -79,17 +80,20 @@ var snapshotScheduleShowCmd = &cobra.Command{
79
80
}
80
81
81
82
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 )
84
86
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 )
86
89
}
87
90
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 )
89
93
}
90
94
}
91
95
92
- ow .WriteTable ()
96
+ ow .WriteKeyValues ()
93
97
}
94
98
},
95
99
}
0 commit comments