Commit Graph

14 Commits

Author SHA1 Message Date
Yong Tang 82bf90ffbc Ignore some functions in the Go template when header is rendered
This fix ignore some functions in the Go template when header is
redendered, so that `--format "{{truncate .ID 1}}"` will still
be able to redener the header correctly.

Additional test cases have been added to the unit test.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-02-10 19:34:50 -08:00
Yong Tang 9dda1155f3 Allow `--format` to use different delim in `table` format
This fix is an attempt to address
https://github.com/docker/docker/pull/28213#issuecomment-273840405

Currently when specify table format with table `--format "table {{.ID}}..."`,
the delimiter in the header section of the table is always `"\t"`.
That is actually different from the content of the table as the delimiter
could be anything (or even contatenated with `.`, for example):
```
$ docker service ps web --format 'table {{.Name}}.{{.ID}}' --no-trunc

NAME                ID
web.1.inyhxhvjcijl0hdbu8lgrwwh7
 \_ web.1.p9m4kx2srjqmfms4igam0uqlb
```

This fix is an attampt to address the skewness of the table when delimiter
is not `"\t"`.

The basic idea is that, when header consists of `table` key, the header section
will be redendered the same way as content section. A map mapping each
placeholder name to the HEADER entry name is used for the context of the header.

Unit tests have been updated and added to cover the changes.

This fix is related to #28313.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-02-10 19:34:50 -08:00
Derek McGowan 635d686a88 Use distribution reference
Remove forked reference package. Use normalized named values
everywhere and familiar functions to convert back to familiar
strings for UX and storage compatibility.

Enforce that the source repository in the distribution metadata
is always a normalized string, ignore invalid values which are not.
Update distribution tests to use normalized values.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-02-07 11:08:37 -08:00
Aaron Lehmann 96c7794e95 Merge pull request #30043 from dmcgowan/distribution-reference-update-1
Distribution reference update
2017-01-24 20:38:20 -08:00
Derek McGowan bbc4ac69fa Remove use of forked reference package for cli
Use resolving to repo info as the split point between the
legitimate reference package and forked reference package.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-01-19 16:04:50 -08:00
Akihiro Suda 775d9759c6 Fix broken JSON support in cli/command/formatter
How to test (it should not print `{}`, and just returns JSON with the actual data):

   $ docker images --format '{{json .}}'
   $ docker container stats --format '{{json .}}'

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-01-19 09:51:13 +00:00
kaiwentan 182bccefbe correct all the formate to formatter
Signed-off-by: kaiwentan <kaiwentan@harmonycloud.cn>
2017-01-19 11:26:49 +08:00
Kenfe-Mickael Laventure ce20950422 Fix ImageSummary.Size value
The prune PR changed the meaning of the file to mean "space on disk
only unique to this image", this PR revert this change.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-01-12 07:49:22 -08:00
Daniel Nephin ef87035bbb Generate api/types:Image from the swagger spec
and rename it to a more appropriate name ImageSummary.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-10-20 13:24:23 -07:00
Kenfe-Mickael Laventure 3f8c4be283 Add new df subcomand to the system command
This command display the state of the data usage of the docker daemon.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-09-30 14:35:23 -07:00
Kenfe-Mickael Laventure 82dc15836b Update Images() to allow retrieving specific image size data
Those data include:
 - size of data shared with other images
 - size of data unique to a given image
 - how many containers are using a given image

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-09-29 07:42:53 -07:00
Daniel Nephin db0952ad22 Refactor formatter.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-09-13 17:58:12 -04:00
Yong Tang c68bb57959 Restrict size to 2 fractional digits for `docker images`
This fix tries to address the issue raised in 26300. Previously
`docker images` will use `HumanSize()` to display the size which
has a fixed precision of 4 (thus 3 fractional digits). This
could be problematic in certain languages (e.g. , German, see
26300) as `.` may be interpreted as thousands-separator in number.

This fix use `CustomSize()` instead and limit the precision to 3
(thus 2 fractional digits).

This fix has been tested manually.

This fix fixes 26300.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-09-08 18:26:50 -07:00
Daniel Nephin 3bd1eb4b76 Move api/client -> cli/command
Using
  gomvpkg
     -from github.com/docker/docker/api/client
     -to github.com/docker/docker/cli/command
     -vcs_mv_cmd 'git mv {{.Src}} {{.Dst}}'

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-09-08 15:46:29 -04:00