docker web -u: display the URL of the web UI

This commit is contained in:
Solomon Hykes 2013-01-20 22:21:59 -08:00
parent bdb66012a8
commit 63081c6cc8

View file

@ -414,10 +414,19 @@ func (docker *Docker) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
func (docker *Docker) CmdWeb(stdin io.ReadCloser, stdout io.Writer, args ...string) error {
if file, err := os.Open("dockerweb.html"); err != nil {
return err
} else if _, err := io.Copy(stdout, file); err != nil {
return err
flags := Subcmd(stdout, "web", "[OPTIONS]", "A web UI for docker")
showurl := flags.Bool("u", false, "Return the URL of the web UI")
if err := flags.Parse(args); err != nil {
return nil
}
if *showurl {
fmt.Fprintln(stdout, "http://localhost:4242/web")
} else {
if file, err := os.Open("dockerweb.html"); err != nil {
return err
} else if _, err := io.Copy(stdout, file); err != nil {
return err
}
}
return nil
}