1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #852 from dotcloud/556-docker-search-fmt

Remove CR/NL from description in docker CLI
This commit is contained in:
Guillaume J. Charmes 2013-06-12 10:17:05 -07:00
commit 3491df6edb
2 changed files with 6 additions and 4 deletions

View file

@ -1082,7 +1082,12 @@ func (cli *DockerCli) CmdSearch(args ...string) error {
w := tabwriter.NewWriter(os.Stdout, 20, 1, 3, ' ', 0)
fmt.Fprintf(w, "NAME\tDESCRIPTION\n")
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()
return nil

View file

@ -63,9 +63,6 @@ func (srv *Server) ImagesSearch(term string) ([]APISearch, error) {
for _, repo := range results.Results {
var out APISearch
out.Description = repo["description"]
if len(out.Description) > 45 {
out.Description = utils.Trunc(out.Description, 42) + "..."
}
out.Name = repo["name"]
outs = append(outs, out)
}