Add StatsFormat to the config.json file

As for `ps`, `images`, `network ls` and `volume ls`, this makes it
possible to define a custom default format.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 908aa5b408
Component: cli
This commit is contained in:
Vincent Demeester
2016-10-28 11:48:25 -07:00
parent af072edbe5
commit e527c56131
+8 -4
View File
@@ -186,13 +186,17 @@ func runStats(dockerCli *command.DockerCli, opts *statsOptions) error {
// before print to screen, make sure each container get at least one valid stat data
waitFirst.Wait()
f := "table"
if len(opts.format) > 0 {
f = opts.format
format := opts.format
if len(format) == 0 {
if len(dockerCli.ConfigFile().StatsFormat) > 0 {
format = dockerCli.ConfigFile().StatsFormat
} else {
format = formatter.TableFormatKey
}
}
statsCtx := formatter.Context{
Output: dockerCli.Out(),
Format: formatter.NewStatsFormat(f, daemonOSType),
Format: formatter.NewStatsFormat(format, daemonOSType),
}
cleanScreen := func() {
if !opts.noStream {