|
@@ -66,6 +66,7 @@ func (p *JSONProgress) String() string {
|
|
}
|
|
}
|
|
|
|
|
|
type JSONMessage struct {
|
|
type JSONMessage struct {
|
|
|
|
+ Stream string `json:"stream,omitempty"`
|
|
Status string `json:"status,omitempty"`
|
|
Status string `json:"status,omitempty"`
|
|
Progress *JSONProgress `json:"progressDetail,omitempty"`
|
|
Progress *JSONProgress `json:"progressDetail,omitempty"`
|
|
ProgressMessage string `json:"progress,omitempty"` //deprecated
|
|
ProgressMessage string `json:"progress,omitempty"` //deprecated
|
|
@@ -87,7 +88,7 @@ func (jm *JSONMessage) Display(out io.Writer, isTerminal bool) error {
|
|
if isTerminal {
|
|
if isTerminal {
|
|
// <ESC>[2K = erase entire current line
|
|
// <ESC>[2K = erase entire current line
|
|
fmt.Fprintf(out, "%c[2K\r", 27)
|
|
fmt.Fprintf(out, "%c[2K\r", 27)
|
|
- endl = "\r\n"
|
|
|
|
|
|
+ endl = "\r"
|
|
}
|
|
}
|
|
if jm.Time != 0 {
|
|
if jm.Time != 0 {
|
|
fmt.Fprintf(out, "[%s] ", time.Unix(jm.Time, 0))
|
|
fmt.Fprintf(out, "[%s] ", time.Unix(jm.Time, 0))
|
|
@@ -102,8 +103,10 @@ func (jm *JSONMessage) Display(out io.Writer, isTerminal bool) error {
|
|
fmt.Fprintf(out, "%s %s%s", jm.Status, jm.Progress.String(), endl)
|
|
fmt.Fprintf(out, "%s %s%s", jm.Status, jm.Progress.String(), endl)
|
|
} else if jm.ProgressMessage != "" { //deprecated
|
|
} else if jm.ProgressMessage != "" { //deprecated
|
|
fmt.Fprintf(out, "%s %s%s", jm.Status, jm.ProgressMessage, endl)
|
|
fmt.Fprintf(out, "%s %s%s", jm.Status, jm.ProgressMessage, endl)
|
|
|
|
+ } else if jm.Stream != "" {
|
|
|
|
+ fmt.Fprintf(out, "%s%s", jm.Stream, endl)
|
|
} else {
|
|
} else {
|
|
- fmt.Fprintf(out, "%s%s", jm.Status, endl)
|
|
|
|
|
|
+ fmt.Fprintf(out, "%s%s\n", jm.Status, endl)
|
|
}
|
|
}
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|