docker web -u: display the URL of the web UI
This commit is contained in:
parent
bdb66012a8
commit
63081c6cc8
1 changed files with 13 additions and 4 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue