mirror of https://github.com/docker/cli.git
cli/command/task: taskContext.Error(): use ellipsis utility
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
0ed80a3a58
commit
2c41bbc49f
|
@ -123,11 +123,11 @@ func (c *taskContext) CurrentState() string {
|
||||||
func (c *taskContext) Error() string {
|
func (c *taskContext) Error() string {
|
||||||
// Trim and quote the error message.
|
// Trim and quote the error message.
|
||||||
taskErr := c.task.Status.Err
|
taskErr := c.task.Status.Err
|
||||||
if c.trunc && len(taskErr) > maxErrLength {
|
if c.trunc {
|
||||||
taskErr = fmt.Sprintf("%s…", taskErr[:maxErrLength-1])
|
taskErr = formatter.Ellipsis(taskErr, maxErrLength)
|
||||||
}
|
}
|
||||||
if len(taskErr) > 0 {
|
if len(taskErr) > 0 {
|
||||||
taskErr = fmt.Sprintf("\"%s\"", taskErr)
|
taskErr = fmt.Sprintf(`"%s"`, taskErr)
|
||||||
}
|
}
|
||||||
return taskErr
|
return taskErr
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue