Skip to content

Commit 478c029

Browse files
committed
chore(ps): pretty At time display
1 parent 67ed5bc commit 478c029

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

cmd/ps.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,13 @@ func (d *DryccCmd) PsDescribe(appID, podID string) error {
144144
for innerKey := range value {
145145
innerValue := strconv.Quote(fmt.Sprintf("%v", value[innerKey]))
146146
if innerKey == "startedAt" || innerKey == "finishedAt" {
147-
innerValue = d.formatTime(fmt.Sprintf("%s", value[innerKey]))
147+
if value[innerKey] != nil {
148+
innerValue = d.formatTime(fmt.Sprintf("%s", value[innerKey]))
149+
} else {
150+
innerValue = "null"
151+
}
148152
}
149-
table.Append([]string{fmt.Sprintf(" %s:", innerKey), innerValue})
153+
table.Append([]string{fmt.Sprintf(" %s:", innerKey), strings.Trim(innerValue, `"`)})
150154
}
151155
}
152156
// LastState
@@ -156,9 +160,13 @@ func (d *DryccCmd) PsDescribe(appID, podID string) error {
156160
for innerKey := range value {
157161
innerValue := strconv.Quote(fmt.Sprintf("%v", value[innerKey]))
158162
if innerKey == "startedAt" || innerKey == "finishedAt" {
159-
innerValue = d.formatTime(fmt.Sprintf("%s", value[innerKey]))
163+
if value[innerKey] != nil {
164+
innerValue = d.formatTime(fmt.Sprintf("%s", value[innerKey]))
165+
} else {
166+
innerValue = "null"
167+
}
160168
}
161-
table.Append([]string{fmt.Sprintf(" %s:", innerKey), innerValue})
169+
table.Append([]string{fmt.Sprintf(" %s:", innerKey), strings.Trim(innerValue, `"`)})
162170
}
163171
}
164172
table.Append([]string{"Ready:", fmt.Sprintf("%v", containerState.Ready)})

0 commit comments

Comments
 (0)