mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Remove CR/NL from description in docker CLI. Also moved description shortening to the client
This commit is contained in:
parent
da937bf214
commit
8d4282cd36
2 changed files with 6 additions and 4 deletions
|
@ -1079,7 +1079,12 @@ func (cli *DockerCli) CmdSearch(args ...string) error {
|
||||||
w := tabwriter.NewWriter(os.Stdout, 20, 1, 3, ' ', 0)
|
w := tabwriter.NewWriter(os.Stdout, 20, 1, 3, ' ', 0)
|
||||||
fmt.Fprintf(w, "NAME\tDESCRIPTION\n")
|
fmt.Fprintf(w, "NAME\tDESCRIPTION\n")
|
||||||
for _, out := range outs {
|
for _, out := range outs {
|
||||||
fmt.Fprintf(w, "%s\t%s\n", out.Name, out.Description)
|
desc := strings.Replace(out.Description, "\n", " ", -1)
|
||||||
|
desc = strings.Replace(desc, "\r", " ", -1)
|
||||||
|
if len(desc) > 45 {
|
||||||
|
desc = utils.Trunc(desc, 42) + "..."
|
||||||
|
}
|
||||||
|
fmt.Fprintf(w, "%s\t%s\n", out.Name, desc)
|
||||||
}
|
}
|
||||||
w.Flush()
|
w.Flush()
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -63,9 +63,6 @@ func (srv *Server) ImagesSearch(term string) ([]APISearch, error) {
|
||||||
for _, repo := range results.Results {
|
for _, repo := range results.Results {
|
||||||
var out APISearch
|
var out APISearch
|
||||||
out.Description = repo["description"]
|
out.Description = repo["description"]
|
||||||
if len(out.Description) > 45 {
|
|
||||||
out.Description = utils.Trunc(out.Description, 42) + "..."
|
|
||||||
}
|
|
||||||
out.Name = repo["name"]
|
out.Name = repo["name"]
|
||||||
outs = append(outs, out)
|
outs = append(outs, out)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue