Remove CR/NL from description in docker CLI
| ... | ... |
@@ -1082,7 +1082,12 @@ func (cli *DockerCli) CmdSearch(args ...string) error {
|
| 1082 | 1082 |
w := tabwriter.NewWriter(os.Stdout, 20, 1, 3, ' ', 0) |
| 1083 | 1083 |
fmt.Fprintf(w, "NAME\tDESCRIPTION\n") |
| 1084 | 1084 |
for _, out := range outs {
|
| 1085 |
- fmt.Fprintf(w, "%s\t%s\n", out.Name, out.Description) |
|
| 1085 |
+ desc := strings.Replace(out.Description, "\n", " ", -1) |
|
| 1086 |
+ desc = strings.Replace(desc, "\r", " ", -1) |
|
| 1087 |
+ if len(desc) > 45 {
|
|
| 1088 |
+ desc = utils.Trunc(desc, 42) + "..." |
|
| 1089 |
+ } |
|
| 1090 |
+ fmt.Fprintf(w, "%s\t%s\n", out.Name, desc) |
|
| 1086 | 1091 |
} |
| 1087 | 1092 |
w.Flush() |
| 1088 | 1093 |
return nil |
| ... | ... |
@@ -63,9 +63,6 @@ func (srv *Server) ImagesSearch(term string) ([]APISearch, error) {
|
| 63 | 63 |
for _, repo := range results.Results {
|
| 64 | 64 |
var out APISearch |
| 65 | 65 |
out.Description = repo["description"] |
| 66 |
- if len(out.Description) > 45 {
|
|
| 67 |
- out.Description = utils.Trunc(out.Description, 42) + "..." |
|
| 68 |
- } |
|
| 69 | 66 |
out.Name = repo["name"] |
| 70 | 67 |
outs = append(outs, out) |
| 71 | 68 |
} |