mirror of
https://github.com/rancher/os.git
synced 2025-09-01 23:04:41 +00:00
Redo logging so its a little more capable
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
This commit is contained in:
63
vendor/github.com/docker/docker/docker/docker.go
generated
vendored
63
vendor/github.com/docker/docker/docker/docker.go
generated
vendored
@@ -7,10 +7,9 @@ import (
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api/client"
|
||||
"github.com/docker/docker/cli"
|
||||
"github.com/docker/docker/dockerversion"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
"github.com/docker/docker/pkg/term"
|
||||
"github.com/docker/docker/utils"
|
||||
"github.com/rancher/os/config"
|
||||
)
|
||||
|
||||
func Main() {
|
||||
@@ -68,10 +67,60 @@ func Main() {
|
||||
}
|
||||
}
|
||||
|
||||
func showVersion() {
|
||||
if utils.ExperimentalBuild() {
|
||||
fmt.Printf("Docker version %s, build %s, experimental\n", dockerversion.Version, dockerversion.GitCommit)
|
||||
} else {
|
||||
fmt.Printf("Docker version %s, build %s\n", dockerversion.Version, dockerversion.GitCommit)
|
||||
// RancherOSMain lets us set the logger, instead of hardcoding it to Stderr
|
||||
func RancherOSMain() {
|
||||
// Set terminal emulation based on platform as required.
|
||||
stdin, stdout, stderr := term.StdStreams()
|
||||
|
||||
flag.Merge(flag.CommandLine, clientFlags.FlagSet, commonFlags.FlagSet)
|
||||
|
||||
flag.Usage = func() {
|
||||
fmt.Fprint(stdout, "Usage: system-docker [OPTIONS] COMMAND [arg...]\n"+daemonUsage+" docker [ --help | -v | --version ]\n\n")
|
||||
fmt.Fprint(stdout, "A self-sufficient runtime for containers.\n\nOptions:\n")
|
||||
|
||||
flag.CommandLine.SetOutput(stdout)
|
||||
flag.PrintDefaults()
|
||||
|
||||
help := "\nCommands:\n"
|
||||
|
||||
for _, cmd := range dockerCommands {
|
||||
help += fmt.Sprintf(" %-10.10s%s\n", cmd.Name, cmd.Description)
|
||||
}
|
||||
|
||||
help += "\nRun 'system-docker COMMAND --help' for more information on a command."
|
||||
fmt.Fprintf(stdout, "%s\n", help)
|
||||
}
|
||||
|
||||
flag.Parse()
|
||||
|
||||
if *flVersion {
|
||||
showVersion()
|
||||
return
|
||||
}
|
||||
|
||||
if *flHelp {
|
||||
// if global flag --help is present, regardless of what other options and commands there are,
|
||||
// just print the usage.
|
||||
flag.Usage()
|
||||
return
|
||||
}
|
||||
|
||||
clientCli := client.NewDockerCli(stdin, stdout, stderr, clientFlags)
|
||||
|
||||
c := cli.New(clientCli, daemonCli)
|
||||
if err := c.Run(flag.Args()...); err != nil {
|
||||
if sterr, ok := err.(cli.StatusError); ok {
|
||||
if sterr.Status != "" {
|
||||
fmt.Fprintln(stderr, sterr.Status)
|
||||
os.Exit(1)
|
||||
}
|
||||
os.Exit(sterr.StatusCode)
|
||||
}
|
||||
fmt.Fprintln(stderr, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func showVersion() {
|
||||
fmt.Printf("RancherOS System-Docker version %s\n", config.Version)
|
||||
}
|
||||
|
Reference in New Issue
Block a user