mirror of https://github.com/docker/docs.git
add TEST env var during tests and silenced parserun during tests
This commit is contained in:
parent
bf98fff925
commit
eee6d3dae9
|
|
@ -0,0 +1,10 @@
|
||||||
|
package docker
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Test(t *testing.T) {
|
||||||
|
os.Setenv("TEST", "1")
|
||||||
|
}
|
||||||
|
|
@ -107,7 +107,7 @@ type KeyValuePair struct {
|
||||||
|
|
||||||
func ParseRun(args []string, capabilities *Capabilities) (*Config, *HostConfig, *flag.FlagSet, error) {
|
func ParseRun(args []string, capabilities *Capabilities) (*Config, *HostConfig, *flag.FlagSet, error) {
|
||||||
cmd := Subcmd("run", "[OPTIONS] IMAGE [COMMAND] [ARG...]", "Run a command in a new container")
|
cmd := Subcmd("run", "[OPTIONS] IMAGE [COMMAND] [ARG...]", "Run a command in a new container")
|
||||||
if len(args) > 0 && args[0] != "--help" {
|
if os.Getenv("TEST") != "" {
|
||||||
cmd.SetOutput(ioutil.Discard)
|
cmd.SetOutput(ioutil.Discard)
|
||||||
cmd.Usage = nil
|
cmd.Usage = nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue