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

remove column size hack

This commit is contained in:
Victor Vieux 2013-11-04 15:34:51 -08:00
parent 747967b4a4
commit 854cc5f559

View file

@ -1429,20 +1429,14 @@ func (cli *DockerCli) CmdSearch(args ...string) error {
}
w := tabwriter.NewWriter(cli.out, 10, 1, 3, ' ', 0)
fmt.Fprintf(w, "NAME\tDESCRIPTION\tSTARS\tOFFICIAL\tTRUSTED\n")
_, width := cli.getTtySize()
if width == 0 {
width = 45
} else {
width = width - 10 - 54 //remote the first column
}
for _, out := range outs {
if (*trusted && !out.IsTrusted) || (*stars > out.StarCount) {
continue
}
desc := strings.Replace(out.Description, "\n", " ", -1)
desc = strings.Replace(desc, "\r", " ", -1)
if !*noTrunc && len(desc) > width {
desc = utils.Trunc(desc, width-3) + "..."
if !*noTrunc && len(desc) > 45 {
desc = utils.Trunc(desc, 42) + "..."
}
fmt.Fprintf(w, "%s\t%s\t%d\t", out.Name, desc, out.StarCount)
if out.IsOfficial {