Browse code

Remove CR/NL from description in docker CLI. Also moved description shortening to the client

shin- authored on 2013/06/07 22:09:24
Showing 2 changed files
... ...
@@ -1079,7 +1079,12 @@ func (cli *DockerCli) CmdSearch(args ...string) error {
1079 1079
 	w := tabwriter.NewWriter(os.Stdout, 20, 1, 3, ' ', 0)
1080 1080
 	fmt.Fprintf(w, "NAME\tDESCRIPTION\n")
1081 1081
 	for _, out := range outs {
1082
-		fmt.Fprintf(w, "%s\t%s\n", out.Name, out.Description)
1082
+		desc := strings.Replace(out.Description, "\n", " ", -1)
1083
+		desc = strings.Replace(desc, "\r", " ", -1)
1084
+		if len(desc) > 45 {
1085
+			desc = utils.Trunc(desc, 42) + "..."
1086
+		}
1087
+		fmt.Fprintf(w, "%s\t%s\n", out.Name, desc)
1083 1088
 	}
1084 1089
 	w.Flush()
1085 1090
 	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
 	}