File tree 2 files changed +20
-2
lines changed
2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -130,8 +130,7 @@ func main() {
130
130
if err != nil {
131
131
return err
132
132
}
133
- fmt .Println (os )
134
- //printer.PrintOS(os)
133
+ printer .PrintOS (os )
135
134
136
135
return nil
137
136
},
Original file line number Diff line number Diff line change @@ -55,3 +55,22 @@ func PrintRegions(regions []providers.Region) {
55
55
output += "└────────┴──────────────────────┘"
56
56
fmt .Print (output )
57
57
}
58
+
59
+ func PrintOS (os []providers.OS ) {
60
+ var output string
61
+ output += "" +
62
+ "┌────────┬──────────────────────┐\n " +
63
+ "│ ID │ Name │\n " +
64
+ "├────────┼──────────────────────┤\n "
65
+
66
+ sort .SliceStable (os , func (i , j int ) bool {
67
+ return os [i ].Name [0 ] < os [j ].Name [0 ]
68
+ })
69
+
70
+ for _ , region := range os {
71
+ output += fmt .Sprintf ("│ %-6v │ %20v │\n " , region .ID , region .Name )
72
+ }
73
+
74
+ output += "└────────┴──────────────────────┘"
75
+ fmt .Print (output )
76
+ }
You can’t perform that action at this time.
0 commit comments