mirror of https://github.com/docker/cli.git
add `--format` flag to `docker info`
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
This commit is contained in:
parent
5a3c9e8c24
commit
420b6a91af
|
@ -1290,9 +1290,15 @@ _docker_import() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_docker_info() {
|
_docker_info() {
|
||||||
|
case "$prev" in
|
||||||
|
--format|-f)
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
case "$cur" in
|
case "$cur" in
|
||||||
-*)
|
-*)
|
||||||
COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
|
COMPREPLY=( $( compgen -W "--format -f --help" -- "$cur" ) )
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,6 +200,8 @@ complete -c docker -A -f -n '__fish_seen_subcommand_from import' -l help -d 'Pri
|
||||||
|
|
||||||
# info
|
# info
|
||||||
complete -c docker -f -n '__fish_docker_no_subcommand' -a info -d 'Display system-wide information'
|
complete -c docker -f -n '__fish_docker_no_subcommand' -a info -d 'Display system-wide information'
|
||||||
|
complete -c docker -A -f -n '__fish_seen_subcommand_from info' -s f -l format -d 'Format the output using the given go template'
|
||||||
|
complete -c docker -A -f -n '__fish_seen_subcommand_from info' -l help -d 'Print usage'
|
||||||
|
|
||||||
# inspect
|
# inspect
|
||||||
complete -c docker -f -n '__fish_docker_no_subcommand' -a inspect -d 'Return low-level information on a container or image'
|
complete -c docker -f -n '__fish_docker_no_subcommand' -a inspect -d 'Return low-level information on a container or image'
|
||||||
|
@ -393,6 +395,8 @@ complete -c docker -A -f -n '__fish_seen_subcommand_from unpause' -a '(__fish_pr
|
||||||
|
|
||||||
# version
|
# version
|
||||||
complete -c docker -f -n '__fish_docker_no_subcommand' -a version -d 'Show the Docker version information'
|
complete -c docker -f -n '__fish_docker_no_subcommand' -a version -d 'Show the Docker version information'
|
||||||
|
complete -c docker -A -f -n '__fish_seen_subcommand_from version' -s f -l format -d 'Format the output using the given go template'
|
||||||
|
complete -c docker -A -f -n '__fish_seen_subcommand_from version' -l help -d 'Print usage'
|
||||||
|
|
||||||
# wait
|
# wait
|
||||||
complete -c docker -f -n '__fish_docker_no_subcommand' -a wait -d 'Block until a container stops, then print its exit code'
|
complete -c docker -f -n '__fish_docker_no_subcommand' -a wait -d 'Block until a container stops, then print its exit code'
|
||||||
|
|
|
@ -1709,7 +1709,8 @@ __docker_subcommand() {
|
||||||
;;
|
;;
|
||||||
(info|version)
|
(info|version)
|
||||||
_arguments $(__docker_arguments) \
|
_arguments $(__docker_arguments) \
|
||||||
$opts_help && ret=0
|
$opts_help \
|
||||||
|
"($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " && ret=0
|
||||||
;;
|
;;
|
||||||
(inspect)
|
(inspect)
|
||||||
local state
|
local state
|
||||||
|
|
|
@ -16,6 +16,7 @@ Usage: docker info
|
||||||
Display system-wide information
|
Display system-wide information
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
|
-f, --format string Format the output using the given go template
|
||||||
--help Print usage
|
--help Print usage
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -24,6 +25,10 @@ Information displayed includes the kernel version, number of containers and imag
|
||||||
The number of images shown is the number of unique images. The same image tagged
|
The number of images shown is the number of unique images. The same image tagged
|
||||||
under different names is counted only once.
|
under different names is counted only once.
|
||||||
|
|
||||||
|
If a format is specified, the given template will be executed instead of the
|
||||||
|
default format. Go's [text/template](http://golang.org/pkg/text/template/) package
|
||||||
|
describes all the details of the format.
|
||||||
|
|
||||||
Depending on the storage driver in use, additional information can be shown, such
|
Depending on the storage driver in use, additional information can be shown, such
|
||||||
as pool name, data file, metadata file, data space used, total data space, metadata
|
as pool name, data file, metadata file, data space used, total data space, metadata
|
||||||
space used, and total metadata space.
|
space used, and total metadata space.
|
||||||
|
@ -144,3 +149,8 @@ information about the devicemapper storage driver is shown:
|
||||||
Insecure registries:
|
Insecure registries:
|
||||||
myinsecurehost:5000
|
myinsecurehost:5000
|
||||||
127.0.0.0/8
|
127.0.0.0/8
|
||||||
|
|
||||||
|
You can also specify the output format:
|
||||||
|
|
||||||
|
$ docker info --format '{{json .}}'
|
||||||
|
{"ID":"I54V:OLXT:HVMM:TPKO:JPHQ:CQCD:JNLC:O3BZ:4ZVJ:43XJ:PFHZ:6N2S","Containers":14, ...}
|
||||||
|
|
|
@ -7,7 +7,7 @@ docker-info - Display system-wide information
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
**docker info**
|
**docker info**
|
||||||
[**--help**]
|
[**--help**]
|
||||||
|
[**-f**|**--format**[=*FORMAT*]]
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
This command displays system wide information regarding the Docker installation.
|
This command displays system wide information regarding the Docker installation.
|
||||||
|
@ -15,6 +15,10 @@ Information displayed includes the kernel version, number of containers and imag
|
||||||
The number of images shown is the number of unique images. The same image tagged
|
The number of images shown is the number of unique images. The same image tagged
|
||||||
under different names is counted only once.
|
under different names is counted only once.
|
||||||
|
|
||||||
|
If a format is specified, the given template will be executed instead of the
|
||||||
|
default format. Go's **text/template** package
|
||||||
|
describes all the details of the format.
|
||||||
|
|
||||||
Depending on the storage driver in use, additional information can be shown, such
|
Depending on the storage driver in use, additional information can be shown, such
|
||||||
as pool name, data file, metadata file, data space used, total data space, metadata
|
as pool name, data file, metadata file, data space used, total data space, metadata
|
||||||
space used, and total metadata space.
|
space used, and total metadata space.
|
||||||
|
@ -28,6 +32,9 @@ available on the volume where `/var/lib/docker` is mounted.
|
||||||
**--help**
|
**--help**
|
||||||
Print usage statement
|
Print usage statement
|
||||||
|
|
||||||
|
**-f**, **--format**=""
|
||||||
|
Format the output using the given go template
|
||||||
|
|
||||||
# EXAMPLES
|
# EXAMPLES
|
||||||
|
|
||||||
## Display Docker system information
|
## Display Docker system information
|
||||||
|
@ -140,6 +147,11 @@ information about the devicemapper storage driver is shown:
|
||||||
myinsecurehost:5000
|
myinsecurehost:5000
|
||||||
127.0.0.0/8
|
127.0.0.0/8
|
||||||
|
|
||||||
|
You can also specify the output format:
|
||||||
|
|
||||||
|
$ docker info --format '{{json .}}'
|
||||||
|
{"ID":"I54V:OLXT:HVMM:TPKO:JPHQ:CQCD:JNLC:O3BZ:4ZVJ:43XJ:PFHZ:6N2S","Containers":14, ...}
|
||||||
|
|
||||||
# HISTORY
|
# HISTORY
|
||||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
||||||
based on docker.com source material and internal work.
|
based on docker.com source material and internal work.
|
||||||
|
|
Loading…
Reference in New Issue