本文整理汇总了Golang中github.com/docker/docker/pkg/mflag.Parse函数的典型用法代码示例。如果您正苦于以下问题:Golang Parse函数的具体用法?Golang Parse怎么用?Golang Parse使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Parse函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: main
func main() {
ignoreIfaceNames := make(stringList)
mflag.Var(&ignoreIfaceNames, []string{"-ignore-iface"}, "name of interface to ignore)")
mflag.Parse()
if len(mflag.Args()) < 1 {
fmt.Fprintln(os.Stderr, "usage: netcheck [--ignore-iface <iface-name>] network-cidr")
os.Exit(1)
}
cidrStr := mflag.Args()[0]
addr, ipnet, err := net.ParseCIDR(cidrStr)
if err != nil {
fatal(err)
}
if ipnet.IP.Equal(addr) {
err = weavenet.CheckNetworkFree(ipnet, ignoreIfaceNames)
} else {
err = weavenet.CheckAddressOverlap(addr, ignoreIfaceNames)
}
if err != nil {
fatal(err)
}
os.Exit(0)
}
开发者ID:codingbunch,项目名称:weave,代码行数:26,代码来源:main.go
示例2: main
func main() {
flag.Parse()
if flLogLevel != "" {
lvl, err := logrus.ParseLevel(flLogLevel)
if err != nil {
fmt.Fprintf(os.Stderr, "Unable to parse logging level: %s\n", flLogLevel)
os.Exit(1)
}
logrus.SetLevel(lvl)
} else {
logrus.SetLevel(logrus.InfoLevel)
}
if flDebug {
logrus.SetLevel(logrus.DebugLevel)
}
d, err := rbd.NewRbdDriver(root, graphOptions)
if err != nil {
logrus.Errorf("Create rbd driver failed: %v", err)
os.Exit(1)
}
h := degraph.NewHandler(d)
logrus.Infof("listening on %s\n", socketAddress)
fmt.Println(h.ServeUnix("root", socketAddress))
}
开发者ID:hustcat,项目名称:docker-rbd-driver,代码行数:28,代码来源:main.go
示例3: readConfig
func readConfig() {
var (
configFile string
showHelp, showVersion bool
)
logFilter = &logutils.LevelFilter{
Levels: logLevels,
MinLevel: logMinLevel,
Writer: os.Stderr,
}
log.SetOutput(logFilter)
flag.StringVar(&configFile, []string{"c", "-config"}, "/etc/logear/logear.conf", "config file")
flag.StringVar(&logFile, []string{"l", "-log"}, "", "log file")
flag.BoolVar(&showHelp, []string{"h", "-help"}, false, "display the help")
flag.BoolVar(&showVersion, []string{"v", "-version"}, false, "display version info")
flag.Parse()
if showHelp {
flag.Usage()
os.Exit(0)
}
if showVersion {
println(versionstring)
println("OS: " + runtime.GOOS)
println("Architecture: " + runtime.GOARCH)
os.Exit(0)
}
parseTomlFile(configFile)
startLogging()
log.Printf("%s started with pid %d", versionstring, os.Getpid())
}
开发者ID:DLag,项目名称:logear,代码行数:30,代码来源:config.go
示例4: init
func init() {
// Check https://github.com/docker/docker/blob/master/pkg/mflag/example/example.go
flag.StringVar(&path, []string{"p", "#pathhidden", "-path"}, "", "path to traverse")
flag.StringVar(&path, []string{"n", "#namehidden", "-name"}, "", "name to traverse")
flag.BoolVar(&h, []string{"h", "#help", "-help"}, false, "display the help")
flag.Parse()
}
开发者ID:klashxx,项目名称:gofind,代码行数:7,代码来源:gofind.go
示例5: main
func main() {
var (
justVersion bool
logLevel = "info"
c proxy.Config
withDNS bool
)
c.Version = version
mflag.BoolVar(&justVersion, []string{"#version", "-version"}, false, "print version and exit")
mflag.StringVar(&logLevel, []string{"-log-level"}, "info", "logging level (debug, info, warning, error)")
mflagext.ListVar(&c.ListenAddrs, []string{"H"}, nil, "addresses on which to listen")
mflag.StringVar(&c.HostnameFromLabel, []string{"-hostname-from-label"}, "", "Key of container label from which to obtain the container's hostname")
mflag.StringVar(&c.HostnameMatch, []string{"-hostname-match"}, "(.*)", "Regexp pattern to apply on container names (e.g. '^aws-[0-9]+-(.*)$')")
mflag.StringVar(&c.HostnameReplacement, []string{"-hostname-replacement"}, "$1", "Expression to generate hostnames based on matches from --hostname-match (e.g. 'my-app-$1')")
mflag.BoolVar(&c.RewriteInspect, []string{"-rewrite-inspect"}, false, "Rewrite 'inspect' calls to return the weave network settings (if attached)")
mflag.BoolVar(&c.NoDefaultIPAM, []string{"#-no-default-ipam", "-no-default-ipalloc"}, false, "do not automatically allocate addresses for containers without a WEAVE_CIDR")
mflag.BoolVar(&c.NoRewriteHosts, []string{"-no-rewrite-hosts"}, false, "do not automatically rewrite /etc/hosts. Use if you need the docker IP to remain in /etc/hosts")
mflag.StringVar(&c.TLSConfig.CACert, []string{"#tlscacert", "-tlscacert"}, "", "Trust certs signed only by this CA")
mflag.StringVar(&c.TLSConfig.Cert, []string{"#tlscert", "-tlscert"}, "", "Path to TLS certificate file")
mflag.BoolVar(&c.TLSConfig.Enabled, []string{"#tls", "-tls"}, false, "Use TLS; implied by --tlsverify")
mflag.StringVar(&c.TLSConfig.Key, []string{"#tlskey", "-tlskey"}, "", "Path to TLS key file")
mflag.BoolVar(&c.TLSConfig.Verify, []string{"#tlsverify", "-tlsverify"}, false, "Use TLS and verify the remote")
mflag.BoolVar(&withDNS, []string{"#-with-dns", "#w"}, false, "option removed")
mflag.BoolVar(&c.WithoutDNS, []string{"-without-dns"}, false, "instruct created containers to never use weaveDNS as their nameserver")
mflag.BoolVar(&c.NoMulticastRoute, []string{"-no-multicast-route"}, false, "do not add a multicast route via the weave interface when attaching containers")
mflag.Parse()
if justVersion {
fmt.Printf("weave proxy %s\n", version)
os.Exit(0)
}
SetLogLevel(logLevel)
Log.Infoln("weave proxy", version)
Log.Infoln("Command line arguments:", strings.Join(os.Args[1:], " "))
if withDNS {
Log.Warning("--with-dns option has been removed; DNS is on by default")
}
c.Image = getenv("EXEC_IMAGE", "weaveworks/weaveexec")
c.DockerBridge = getenv("DOCKER_BRIDGE", "docker0")
c.DockerHost = getenv("DOCKER_HOST", "unix:///var/run/docker.sock")
c.ProcPath = getenv("PROCFS", "/proc")
p, err := proxy.NewProxy(c)
if err != nil {
Log.Fatalf("Could not start proxy: %s", err)
}
defer p.Stop()
listeners := p.Listen()
p.AttachExistingContainers()
go p.Serve(listeners)
go p.ListenAndServeStatus("/home/weave/status.sock")
SignalHandlerLoop()
}
开发者ID:brb,项目名称:weave,代码行数:60,代码来源:main.go
示例6: main
func main() {
var (
as []string
hostMatch string
)
mflagext.ListVar(&as, []string{"a", "-alias"}, []string{}, "Specify hostname aliases in the form alias:hostname. Can be repeated.")
mflag.StringVar(&hostMatch, []string{"h", "-host-match"}, "*.weave.local", "Specify main host shExpMatch expression in pacfile")
mflag.Parse()
var aliases = map[string]string{}
for _, a := range as {
parts := strings.SplitN(a, ":", 2)
if len(parts) != 2 {
fmt.Printf("'%s' is not a valid alias.\n", a)
mflag.Usage()
os.Exit(1)
}
aliases[parts[0]] = parts[1]
}
go socksProxy(aliases)
t := template.Must(template.New("pacfile").Parse(pacfile))
http.HandleFunc("/proxy.pac", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/x-ns-proxy-autoconfig")
t.Execute(w, pacFileParameters{hostMatch, aliases})
})
if err := http.ListenAndServe(":8080", nil); err != nil {
panic(err)
}
}
开发者ID:dilgerma,项目名称:scope,代码行数:32,代码来源:main.go
示例7: parseConf
// parse conf from env and args
func parseConf() {
// let mflag parse first
mflag.Parse()
// using gconf parse env
gconf, err := globalconf.NewWithOptions(&globalconf.Options{
EnvPrefix: "WICKET_",
})
if err != nil {
log.Fatalf("error parsing config file: %v", err)
}
fs := flag.NewFlagSet("", flag.ContinueOnError)
mflag.VisitAll(func(f *mflag.Flag) {
for _, n := range f.Names {
if len(n) < 2 {
continue
}
n = strings.TrimPrefix(n, "-")
fs.Var(f.Value, n, f.Usage)
}
})
gconf.ParseSet("", fs)
}
开发者ID:yangzx554,项目名称:docker-wicket,代码行数:30,代码来源:main.go
示例8: main
func main() {
mflag.BoolVar(&useScheduler, []string{"scheduler"}, false, "Use scheduler to distribute tests across shards")
mflag.BoolVar(&runParallel, []string{"parallel"}, false, "Run tests in parallel on hosts where possible")
mflag.Parse()
tests, err := getTests(mflag.Args())
if err != nil {
fmt.Printf("Error parsing tests: %v\n", err)
os.Exit(1)
}
hosts := strings.Fields(os.Getenv("HOSTS"))
maxHosts := len(hosts)
if maxHosts == 0 {
fmt.Print("No HOSTS specified.\n")
os.Exit(1)
}
var errored bool
if runParallel {
errored = parallel(tests, hosts)
} else {
errored = sequential(tests, hosts)
}
if errored {
os.Exit(1)
}
}
开发者ID:paladin74,项目名称:weave,代码行数:29,代码来源:runner.go
示例9: main
func main() {
mflag.BoolVar(&useScheduler, []string{"scheduler"}, false, "Use scheduler to distribute tests across shards")
mflag.BoolVar(&runParallel, []string{"parallel"}, false, "Run tests in parallel on hosts where possible")
mflag.BoolVar(&verbose, []string{"v"}, false, "Print output from all tests (Also enabled via DEBUG=1)")
mflag.StringVar(&schedulerHost, []string{"scheduler-host"}, defaultSchedulerHost, "Hostname of scheduler.")
mflag.Parse()
if len(os.Getenv("DEBUG")) > 0 {
verbose = true
}
tests, err := getTests(mflag.Args())
if err != nil {
fmt.Printf("Error parsing tests: %v\n", err)
os.Exit(1)
}
hosts := strings.Fields(os.Getenv("HOSTS"))
maxHosts := len(hosts)
if maxHosts == 0 {
fmt.Print("No HOSTS specified.\n")
os.Exit(1)
}
var errored bool
if runParallel {
errored = parallel(tests, hosts)
} else {
errored = sequential(tests, hosts)
}
if errored {
os.Exit(1)
}
}
开发者ID:pauloheck,项目名称:scope,代码行数:35,代码来源:runner.go
示例10: main
func main() {
if reexec.Init() {
return
}
// Set terminal emulation based on platform as required.
stdin, stdout, stderr := term.StdStreams()
logrus.SetOutput(stderr)
flag.Merge(flag.CommandLine, clientFlags.FlagSet, commonFlags.FlagSet)
flag.Usage = func() {
fmt.Fprint(os.Stdout, "Usage: docker [OPTIONS] COMMAND [arg...]\n"+daemonUsage+" docker [ -h | --help | -v | --version ]\n\n")
fmt.Fprint(os.Stdout, "A self-sufficient runtime for containers.\n\nOptions:\n")
flag.CommandLine.SetOutput(os.Stdout)
flag.PrintDefaults()
help := "\nCommands:\n"
for _, cmd := range dockerCommands {
help += fmt.Sprintf(" %-10.10s%s\n", cmd.name, cmd.description)
}
help += "\nRun 'docker COMMAND --help' for more information on a command."
fmt.Fprintf(os.Stdout, "%s\n", help)
}
flag.Parse()
if *flVersion {
showVersion()
return
}
clientCli := client.NewDockerCli(stdin, stdout, stderr, clientFlags)
// TODO: remove once `-d` is retired
handleGlobalDaemonFlag()
if *flHelp {
// if global flag --help is present, regardless of what other options and commands there are,
// just print the usage.
flag.Usage()
return
}
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(os.Stderr, sterr.Status)
os.Exit(1)
}
os.Exit(sterr.StatusCode)
}
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
开发者ID:nilsotto,项目名称:docker,代码行数:60,代码来源:docker.go
示例11: init
func init() {
flag.Bool([]string{"h", "-help"}, false, "Display help")
flag.BoolVar(&verbose, []string{"v", "-verbose"}, false, "Switch to verbose output")
flag.BoolVar(&print_digest, []string{"d", "-digest"}, false, "Print also digest of manifest")
flag.StringVar(&key, []string{"k", "-key-file"}, "", "Private key with which to sign")
flag.Parse()
}
开发者ID:TomasTomecek,项目名称:docker-manifest,代码行数:7,代码来源:main.go
示例12: init
func init() {
// Arguments for ssh server
flag.BoolVar(&h, []string{"h", "#help", "-help"}, false,
"display this help message")
flag.BoolVar(&server, []string{"s", "-server"}, false,
"start the server")
flag.StringVar(&listen, []string{"l", "-listen"}, "0.0.0.0",
"start the server")
flag.IntVar(&port, []string{"p", "-port"}, 5566,
"port to listen")
flag.StringVar(&user, []string{"-user"}, "sshcam",
"username for SSH login")
flag.StringVar(&pass, []string{"-pass"}, "[email protected]",
"password for SSH login")
// Arguments for img2xterm
flag.BoolVar(&colorful, []string{"c", "-color"}, false,
"turn on color")
flag.BoolVar(&asciiOnly, []string{"-ascii-only"}, false,
"fallback to use ASCII's full block characters")
flag.StringVar(&distanceAlgorithm, []string{"-color-algorithm"}, "yiq",
"algorithm use to compute colors. Available options are:\n"+
"'rgb': simple linear distance in RGB colorspace\n"+
"'yiq': simple linear distance in YIQ colorspace (the default)\n"+
"'cie94': use the CIE94 formula")
flag.IntVar(&maxFPS, []string{"-max-fps"}, 4,
"limit the maximum FPS")
flag.StringVar(&device, []string{"-device"}, "/dev/video0",
"the webcam device to open")
flag.StringVar(&sizeFlag, []string{"-size"}, "640x480",
"image dimension, must be supported by the device")
flag.Parse()
size = wxh2Size(sizeFlag)
}
开发者ID:cs12b033,项目名称:sshcam,代码行数:35,代码来源:sshcam.go
示例13: init
func init() {
flag.StringVar(&tplfile, []string{"t", "-template"}, "", "Template file name for produce config file.")
flag.StringVar(&appName, []string{"-app"}, "appname", "App name for upstream/logfile name/conf name/consul key.")
flag.StringVar(&output, []string{"o", "-output"}, "appname.conf", "Config file name for save config file.")
flag.BoolVar(&help, []string{"h", "-help"}, false, "Display the help")
flag.Parse()
}
开发者ID:soarpenguin,项目名称:go-scripts,代码行数:7,代码来源:namedtpl.go
示例14: init
func init() {
flag.BoolVar(&help, []string{"h", "-help"}, false, "Display help")
flag.BoolVar(&verbose, []string{"v", "-verbose"}, false, "Switch to verbose output")
flag.Var(&keys, []string{"k", "-key-file"}, "Private key with which to sign")
flag.Parse()
if kk := flag.Lookup("-k"); kk != nil {
keys = *kk.Value.(*opts.ListOpts)
}
}
开发者ID:shaded-enmity,项目名称:docker-tar-push,代码行数:9,代码来源:main.go
示例15: dnetCommand
func dnetCommand(stdout, stderr io.Writer) error {
flag.Parse()
if *flHelp {
flag.Usage()
return nil
}
if *flLogLevel != "" {
lvl, err := logrus.ParseLevel(*flLogLevel)
if err != nil {
fmt.Fprintf(stderr, "Unable to parse logging level: %s\n", *flLogLevel)
return err
}
logrus.SetLevel(lvl)
} else {
logrus.SetLevel(logrus.InfoLevel)
}
if *flDebug {
logrus.SetLevel(logrus.DebugLevel)
}
if *flHost == "" {
defaultHost := os.Getenv("DNET_HOST")
if defaultHost == "" {
// TODO : Add UDS support
defaultHost = fmt.Sprintf("tcp://%s:%d", DefaultHTTPHost, DefaultHTTPPort)
}
*flHost = defaultHost
}
dc, err := newDnetConnection(*flHost)
if err != nil {
if *flDaemon {
logrus.Error(err)
} else {
fmt.Fprint(stderr, err)
}
return err
}
if *flDaemon {
err := dc.dnetDaemon()
if err != nil {
logrus.Errorf("dnet Daemon exited with an error : %v", err)
}
return err
}
cli := client.NewNetworkCli(stdout, stderr, dc.httpCall)
if err := cli.Cmd("dnet", flag.Args()...); err != nil {
fmt.Fprintln(stderr, err)
return err
}
return nil
}
开发者ID:wcwxyz,项目名称:libnetwork,代码行数:57,代码来源:dnet.go
示例16: init
func init() {
flag.StringVar(&tplfile, []string{"t", "-template"}, "server.conf.template", "Template file name for produce config file.")
flag.StringVar(&appName, []string{"-app"}, "appname", "App name for upstream/logfile name/conf name/consul key.")
flag.StringVar(&consulIp, []string{"c", "-consul"}, "10.10.10.10:8500", "Consul server 'url:port' for get upstream info.")
flag.StringVar(&virtualIp, []string{"v", "-virtualip"}, "0.0.0.0:81,0.0.0.1", "Virtual IP/PORT list for this app.")
flag.StringVar(&output, []string{"o", "-output"}, "appname.conf", "Config file name for save config file.")
flag.BoolVar(&help, []string{"h", "-help"}, false, "Display the help")
flag.Parse()
}
开发者ID:soarpenguin,项目名称:go-scripts,代码行数:9,代码来源:tplparse.go
示例17: init
func init() {
logrus.SetOutput(os.Stdout)
logrus.SetLevel(logrus.DebugLevel)
mflag.BoolVar(&master, []string{"m", "-master", "#mt"}, false, "if the master server.")
mflag.BoolVar(&help, []string{"h", "-help", "#hhhhelp"}, false, "show help.")
mflag.StringVar(&env, []string{"e", "-env"}, "test", "which config env to run.")
// mflag.BoolVar(&picture, []string{"i", "-image"}, false, "download the picture that go throuth.")
mflag.StringVar(&conffile, []string{"f", "-config"}, "", "point a config file.default is config/config.json.")
mflag.Parse()
}
开发者ID:qwding,项目名称:go_distributed_spider,代码行数:11,代码来源:distribute.go
示例18: init
func init() {
flag.Bool([]string{"#hp", "#-halp"}, false, "display the halp")
flag.BoolVar(&b, []string{"b", "#bal", "#bol", "-bal"}, false, "a simple bool")
flag.BoolVar(&b, []string{"g", "#gil"}, false, "a simple bool")
flag.BoolVar(&b2, []string{"#-bool"}, false, "a simple bool")
flag.IntVar(&i, []string{"-integer", "-number"}, -1, "a simple integer")
flag.StringVar(&str, []string{"s", "#hidden", "-string"}, "", "a simple string") //-s -hidden and --string will work, but -hidden won't be in the usage
flag.BoolVar(&h, []string{"h", "#help", "-help"}, false, "display the help")
flag.StringVar(&str, []string{"mode"}, "mode1", "set the mode\nmode1: use the mode1\nmode2: use the mode2\nmode3: use the mode3")
flag.Parse()
}
开发者ID:maxim28,项目名称:docker,代码行数:11,代码来源:example.go
示例19: main
func main() {
fmt.Print("Hello, world\n")
// Define global flag here
// end global flag definition
flag.Usage = func() {
fmt.Fprint(os.Stdout, "Usage: docking [OPTIONS] COMMAND [arg...]\n docking [ --help | -v | --version ]\n\n")
fmt.Fprint(os.Stdout, "A self-sufficient runtime for containers.\n\nOptions:\n")
flag.CommandLine.SetOutput(os.Stdout)
flag.PrintDefaults()
help := "\nCommands:\n"
for _, cmd := range dockingCommands {
help += fmt.Sprintf(" %-10.10s%s\n", cmd.Name, cmd.Description)
}
help += "\nRun 'docking COMMAND --help' for more information on a command."
fmt.Fprintf(os.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.NewDockingCli(os.Stdin, os.Stdout, os.Stderr, clientFlags)
c := cli.New(clientCli)
if err := c.Run(flag.Args()...); err != nil {
if sterr, ok := err.(cli.StatusError); ok {
if sterr.Status != "" {
fmt.Fprintln(os.Stderr, sterr.Status)
os.Exit(1)
}
os.Exit(sterr.StatusCode)
}
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
开发者ID:docking-tools,项目名称:docking-tools,代码行数:53,代码来源:docking.go
示例20: main
func main() {
var (
justVersion bool
logLevel = "info"
c = proxy.Config{ListenAddrs: []string{}}
)
c.Version = version
mflag.BoolVar(&justVersion, []string{"#version", "-version"}, false, "print version and exit")
mflag.StringVar(&logLevel, []string{"-log-level"}, "info", "logging level (debug, info, warning, error)")
mflagext.ListVar(&c.ListenAddrs, []string{"H"}, nil, "addresses on which to listen")
mflag.StringVar(&c.HostnameFromLabel, []string{"-hostname-from-label"}, "", "Key of container label from which to obtain the container's hostname")
mflag.StringVar(&c.HostnameMatch, []string{"-hostname-match"}, "(.*)", "Regexp pattern to apply on container names (e.g. '^aws-[0-9]+-(.*)$')")
mflag.StringVar(&c.HostnameReplacement, []string{"-hostname-replacement"}, "$1", "Expression to generate hostnames based on matches from --hostname-match (e.g. 'my-app-$1')")
mflag.BoolVar(&c.RewriteInspect, []string{"-rewrite-inspect"}, false, "Rewrite 'inspect' calls to return the weave network settings (if attached)")
mflag.BoolVar(&c.NoDefaultIPAM, []string{"#-no-default-ipam", "-no-default-ipalloc"}, false, "do not automatically allocate addresses for containers without a WEAVE_CIDR")
mflag.BoolVar(&c.NoRewriteHosts, []string{"-no-rewrite-hosts"}, false, "do not automatically rewrite /etc/hosts. Use if you need the docker IP to remain in /etc/hosts")
mflag.StringVar(&c.TLSConfig.CACert, []string{"#tlscacert", "-tlscacert"}, "", "Trust certs signed only by this CA")
mflag.StringVar(&c.TLSConfig.Cert, []string{"#tlscert", "-tlscert"}, "", "Path to TLS certificate file")
mflag.BoolVar(&c.TLSConfig.Enabled, []string{"#tls", "-tls"}, false, "Use TLS; implied by --tls-verify")
mflag.StringVar(&c.TLSConfig.Key, []string{"#tlskey", "-tlskey"}, "", "Path to TLS key file")
mflag.BoolVar(&c.TLSConfig.Verify, []string{"#tlsverify", "-tlsverify"}, false, "Use TLS and verify the remote")
mflag.BoolVar(&c.WithDNS, []string{"-with-dns", "w"}, false, "instruct created containers to always use weaveDNS as their nameserver")
mflag.BoolVar(&c.WithoutDNS, []string{"-without-dns"}, false, "instruct created containers to never use weaveDNS as their nameserver")
mflag.Parse()
if justVersion {
fmt.Printf("weave proxy %s\n", version)
os.Exit(0)
}
if c.WithDNS && c.WithoutDNS {
Log.Fatalf("Cannot use both '--with-dns' and '--without-dns' flags")
}
SetLogLevel(logLevel)
Log.Infoln("weave proxy", version)
Log.Infoln("Command line arguments:", strings.Join(os.Args[1:], " "))
p, err := proxy.NewProxy(c)
if err != nil {
Log.Fatalf("Could not start proxy: %s", err)
}
listeners := p.Listen()
p.AttachExistingContainers()
go p.Serve(listeners)
go p.ListenAndServeStatus("/home/weave/status.sock")
SignalHandlerLoop()
}
开发者ID:ravisinghsfbay,项目名称:weave,代码行数:52,代码来源:main.go
注:本文中的github.com/docker/docker/pkg/mflag.Parse函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论