mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
a0cccbbcfa
In prep for the UI/API updates on Docker to integrate the network and endpoints, this PR removes the experimental tag from dnet and moving it to docker UI and API and wrap the top-level "network" and "service" under experimental. Signed-off-by: Madhu Venugopal <madhu@docker.com>
50 lines
1.2 KiB
Go
50 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
flag "github.com/docker/docker/pkg/mflag"
|
|
)
|
|
|
|
type command struct {
|
|
name string
|
|
description string
|
|
}
|
|
|
|
type byName []command
|
|
|
|
var (
|
|
flDaemon = flag.Bool([]string{"d", "-daemon"}, false, "Enable daemon mode")
|
|
flHost = flag.String([]string{"H", "-host"}, "", "Daemon socket to connect to")
|
|
flLogLevel = flag.String([]string{"l", "-log-level"}, "info", "Set the logging level")
|
|
flDebug = flag.Bool([]string{"D", "-debug"}, false, "Enable debug mode")
|
|
flHelp = flag.Bool([]string{"h", "-help"}, false, "Print usage")
|
|
|
|
dnetCommands = []command{
|
|
{"network", "Network management commands"},
|
|
{"service", "Service management commands"},
|
|
}
|
|
)
|
|
|
|
func init() {
|
|
flag.Usage = func() {
|
|
fmt.Fprint(os.Stdout, "Usage: dnet [OPTIONS] COMMAND [arg...]\n\nA self-sufficient runtime for container networking.\n\nOptions:\n")
|
|
|
|
flag.CommandLine.SetOutput(os.Stdout)
|
|
flag.PrintDefaults()
|
|
|
|
help := "\nCommands:\n"
|
|
|
|
for _, cmd := range dnetCommands {
|
|
help += fmt.Sprintf(" %-10.10s%s\n", cmd.name, cmd.description)
|
|
}
|
|
|
|
help += "\nRun 'dnet COMMAND --help' for more information on a command."
|
|
fmt.Fprintf(os.Stdout, "%s\n", help)
|
|
}
|
|
}
|
|
|
|
func printUsage() {
|
|
fmt.Println("Usage: dnet <OPTIONS> COMMAND [arg...]")
|
|
}
|