2015-05-04 14:55:36 -07:00
|
|
|
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")
|
2015-05-19 13:04:16 -07:00
|
|
|
flHost = flag.String([]string{"H", "-host"}, "", "Daemon socket to connect to")
|
2015-05-04 14:55:36 -07:00
|
|
|
flLogLevel = flag.String([]string{"l", "-log-level"}, "info", "Set the logging level")
|
|
|
|
flDebug = flag.Bool([]string{"D", "-debug"}, false, "Enable debug mode")
|
2015-06-11 06:52:46 -07:00
|
|
|
flCfgFile = flag.String([]string{"c", "-cfg-file"}, "/etc/default/libnetwork.toml", "Configuration file")
|
2015-05-04 14:55:36 -07:00
|
|
|
flHelp = flag.Bool([]string{"h", "-help"}, false, "Print usage")
|
|
|
|
|
|
|
|
dnetCommands = []command{
|
|
|
|
{"network", "Network management commands"},
|
2015-06-08 04:17:24 -07:00
|
|
|
{"service", "Service management commands"},
|
2015-05-04 14:55:36 -07:00
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
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() {
|
2015-06-08 04:17:24 -07:00
|
|
|
fmt.Println("Usage: dnet <OPTIONS> COMMAND [arg...]")
|
2015-05-04 14:55:36 -07:00
|
|
|
}
|