@@ -10,15 +10,13 @@ import (
10
10
"gopkg.in/yaml.v3"
11
11
)
12
12
13
- func formatOutput (wideOutput bool , status any ) {
14
- if st , ok := status .(otaapi.Ota ); ok {
15
- if ! wideOutput {
16
- st .DeviceID = ""
17
- st .ErrorReason = ""
18
- st .Sha256 = ""
19
- }
20
- printOut (st , wideOutput )
13
+ func formatOtaByIdOutput (wideOutput bool , st * otaapi.OtaStatusResponse ) {
14
+ if ! wideOutput {
15
+ st .Ota .DeviceID = ""
16
+ st .Ota .ErrorReason = ""
17
+ st .Ota .Sha256 = ""
21
18
}
19
+ printOut (st , wideOutput )
22
20
}
23
21
24
22
func formatOutputSlice (wideOutput bool , st []otaapi.Ota ) {
@@ -50,13 +48,12 @@ func printOut(res any, wideOutput bool) {
50
48
}
51
49
}
52
50
if outputformat == feedback .Text {
53
- if st , ok := res .(otaapi.Ota ); ok {
54
- if wideOutput {
55
- fmt .Println (st .GetWideCSVHeader ())
56
- fmt .Println (st .ToWideCSV ())
57
- } else {
58
- fmt .Println (st .GetCSVHeader ())
59
- fmt .Println (st .ToCSV ())
51
+ if st , ok := res .(* otaapi.OtaStatusResponse ); ok {
52
+ fmt .Println (st .Ota .ToText ())
53
+ fmt .Println ()
54
+ fmt .Println ("Details:" )
55
+ for i := range st .States {
56
+ fmt .Println (st .States [i ].ToText ())
60
57
}
61
58
}
62
59
if st , ok := res .([]otaapi.Ota ); ok {
@@ -92,7 +89,7 @@ func PrintOtaStatus(otaid, device, otaidpath string, wideOutput bool, cred *conf
92
89
} else if otaid != "" {
93
90
res , err := otapi .GetOtaStatusByOtaID (otaid )
94
91
if err == nil && res != nil {
95
- formatOutput (wideOutput , res . Ota )
92
+ formatOtaByIdOutput (wideOutput , res )
96
93
} else if err != nil {
97
94
return err
98
95
}
0 commit comments