From 847ccd4867ae99d02eb882d631c2b8219450ab22 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 30 Dec 2016 17:35:46 +0100 Subject: [PATCH] Improve usage output for docker run Commit a77f2450c70312f8c26877a18bfe2baa44d4abb9 switched `docker run` to use the `pflags` package. Due to this change, the usage output for the `--blkio-weight-device` and `--device-*` flags changed and now showed `weighted-device`, and `throttled-device` as value type. As a result, the output of `docker run --help` became a lot wider. This patch changes the output to show `list` instead, which is consistent with other options that allow to be set multiple times. Output before this change; Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...] Run a command in a new container Options: --blkio-weight uint16 Block IO (relative weight), between 10 and 1000, or 0 to disable (default 0) --blkio-weight-device weighted-device Block IO weight (relative device weight) (default []) --device list Add a host device to the container (default []) --device-read-bps throttled-device Limit read rate (bytes per second) from a device (default []) --device-read-iops throttled-device Limit read rate (IO per second) from a device (default []) --device-write-bps throttled-device Limit write rate (bytes per second) to a device (default []) --device-write-iops throttled-device Limit write rate (IO per second) to a device (default []) -w, --workdir string Working directory inside the container Output after this change; Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...] Run a command in a new container Options: --blkio-weight uint16 Block IO (relative weight), between 10 and 1000, or 0 to disable (default 0) --blkio-weight-device list Block IO weight (relative device weight) (default []) --device list Add a host device to the container (default []) --device-read-bps list Limit read rate (bytes per second) from a device (default []) --device-read-iops list Limit read rate (IO per second) from a device (default []) --device-write-bps list Limit write rate (bytes per second) to a device (default []) --device-write-iops list Limit write rate (IO per second) to a device (default []) -w, --workdir string Working directory inside the container Signed-off-by: Sebastiaan van Stijn --- opts/throttledevice.go | 2 +- opts/weightdevice.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/opts/throttledevice.go b/opts/throttledevice.go index 5024324298..65dd3ebf68 100644 --- a/opts/throttledevice.go +++ b/opts/throttledevice.go @@ -107,5 +107,5 @@ func (opt *ThrottledeviceOpt) GetList() []*blkiodev.ThrottleDevice { // Type returns the option type func (opt *ThrottledeviceOpt) Type() string { - return "throttled-device" + return "list" } diff --git a/opts/weightdevice.go b/opts/weightdevice.go index 2a5da6da08..7e3d064f27 100644 --- a/opts/weightdevice.go +++ b/opts/weightdevice.go @@ -85,5 +85,5 @@ func (opt *WeightdeviceOpt) GetList() []*blkiodev.WeightDevice { // Type returns the option type func (opt *WeightdeviceOpt) Type() string { - return "weighted-device" + return "list" }