本文整理汇总了Golang中flag.BoolVar函数的典型用法代码示例。如果您正苦于以下问题:Golang BoolVar函数的具体用法?Golang BoolVar怎么用?Golang BoolVar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了BoolVar函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: init

func init() {
    flag.StringVar(&options.CPUProfile, "cpuprofile", "", "write cpu profile to file")
    flag.Uint64Var(&options.SpoolSize, "spool-size", 1024,
        "Maximum number of events to spool before a flush is forced.")
    flag.IntVar(&options.NumWorkers, "num-workers", 1,
        "deprecated option, strictly for backwards compatibility. does nothing.")
    flag.DurationVar(&options.IdleTimeout, "idle-flush-time", 5*time.Second,
        "Maximum time to wait for a full spool before flushing anyway")
    flag.StringVar(&options.ConfigFile, "config", "", "The config file to load")
    flag.StringVar(&options.LogFile, "log-file", "", "Log file output")
    flag.StringVar(&options.PidFile, "pid-file", "lumberjack.pid",
        "destination to which a pidfile will be written")
    flag.BoolVar(&options.UseSyslog, "log-to-syslog", false,
        "Log to syslog instead of stdout. This option overrides the --log-file option.")
    flag.BoolVar(&options.FromBeginning, "from-beginning", false,
        "Read new files from the beginning, instead of the end")
    flag.StringVar(&options.HistoryPath, "progress-file", ".lumberjack",
        "path of file used to store progress data")
    flag.StringVar(&options.TempDir, "temp-dir", "/tmp",
        "directory for creating temp files")
    flag.IntVar(&options.NumThreads, "threads", 1, "Number of OS threads to use")
    flag.IntVar(&options.CmdPort, "cmd-port", 42586, "tcp command port number")
    flag.StringVar(&options.HttpPort, "http", "",
        "http port for debug info. No http server is run if this is left off. E.g.: http=:6060")
}

开发者ID:postfix,项目名称:logstash-forwarder,代码行数:25,代码来源:options.go

示例2: initFlags

func initFlags() {

    certPath := filepath.Join(os.Getenv("DOCKER_CERT_PATH"))
    if certPath == "" {
        certPath = filepath.Join(os.Getenv("HOME"), ".docker")
    }
    flag.BoolVar(&version, "version", false, "show version")
    flag.BoolVar(&watch, "watch", false, "watch for container changes")
    flag.BoolVar(&onlyExposed, "only-exposed", false, "only include containers with exposed ports")

    flag.BoolVar(&onlyPublished, "only-published", false,
        "only include containers with published ports (implies -only-exposed)")
    flag.StringVar(&notifyCmd, "notify", "", "run command after template is regenerated (e.g `restart xyz`)")
    flag.StringVar(&notifySigHUPContainerID, "notify-sighup", "",
        "send HUP signal to container.  Equivalent to `docker kill -s HUP container-ID`")
    flag.Var(&configFiles, "config", "config files with template directives. Config files will be merged if this option is specified multiple times.")
    flag.IntVar(&interval, "interval", 0, "notify command interval (secs)")
    flag.StringVar(&endpoint, "endpoint", "", "docker api endpoint (tcp|unix://..). Default unix:///var/run/docker.sock")
    flag.StringVar(&tlsCert, "tlscert", filepath.Join(certPath, "cert.pem"), "path to TLS client certificate file")
    flag.StringVar(&tlsKey, "tlskey", filepath.Join(certPath, "key.pem"), "path to TLS client key file")
    flag.StringVar(&tlsCaCert, "tlscacert", filepath.Join(certPath, "ca.pem"), "path to TLS CA certificate file")
    flag.BoolVar(&tlsVerify, "tlsverify", os.Getenv("DOCKER_TLS_VERIFY") != "", "verify docker daemon's TLS certicate")

    flag.Usage = usage
    flag.Parse()
}

开发者ID:nurav,项目名称:docker-gen,代码行数:26,代码来源:docker-gen.go

示例3: main

func main() {
    var bindAddress string
    var port int

    flag.IntVar(&port, "port", 9125, "Port to listen on")
    flag.IntVar(&port, "p", 9125, "Port to listen on")

    flag.StringVar(&bindAddress, "bind", "0.0.0.0", "IP Address to listen on")
    flag.StringVar(&bindAddress, "b", "0.0.0.0", "IP Address to listen on")

    flag.StringVar(&prefix, "prefix", "statsrelay", "The prefix to use with self generated stats")

    flag.BoolVar(&verbose, "verbose", false, "Verbose output")
    flag.BoolVar(&verbose, "v", false, "Verbose output")

    flag.Parse()

    if len(flag.Args()) == 0 {
        log.Fatalf("One or most host specifications are needed to locate statsd daemons.\n")
    }

    hashRing = consistent.New()
    hashRing.NumberOfReplicas = 1

    for _, v := range flag.Args() {
        var addr *net.UDPAddr
        var err error
        host := strings.Split(v, ":")

        switch len(host) {
        case 1:
            log.Printf("Invalid statsd location: %s\n", v)
            log.Fatalf("Must be of the form HOST:PORT or HOST:PORT:INSTANCE\n")
        case 2:
            addr, err = net.ResolveUDPAddr("udp", v)
            if err != nil {
                log.Printf("Error parsing HOST:PORT \"%s\"\n", v)
                log.Fatalf("%s\n", err.Error())
            }
        case 3:
            addr, err = net.ResolveUDPAddr("udp", host[0]+":"+host[1])
            if err != nil {
                log.Printf("Error parsing HOST:PORT:INSTANCE \"%s\"\n", v)
                log.Fatalf("%s\n", err.Error())
            }
        default:
            log.Fatalf("Unrecongnized host specification: %s\n", v)
        }

        if addr != nil {
            udpAddr[v] = addr
            hashRing.Add(v)
        }
    }

    epochTime = time.Now().Unix()
    runServer(bindAddress, port)

    log.Printf("Normal shutdown.\n")
}

开发者ID:denen99,项目名称:statsrelay,代码行数:60,代码来源:statsrelay.go

示例4: setOptions

func (c *cover) setOptions() {
    flag.BoolVar(&c.set, "cover", false, "Use the cover tool.")
    flag.BoolVar(&c.open, "open", true,
        "Open the results of the cover tool on the browser.")
    flag.Float64Var(&c.threshold,
        "threshold", defaultThreshold, "The accepted code coverage threshold.")
}

开发者ID:mssola,项目名称:climate,代码行数:7,代码来源:cover.go

示例5: parseArgs

func parseArgs() args {
    var a args

    // setup + parse flags
    flag.BoolVar(&a.listen, "listen", false, "listen for connections")
    flag.BoolVar(&a.listen, "l", false, "listen for connections (short)")
    flag.BoolVar(&a.verbose, "v", false, "verbose debugging")
    flag.Usage = Usage
    flag.Parse()
    osArgs := flag.Args()

    if len(osArgs) < 1 {
        exit("")
    }

    if a.listen {
        a.localAddr = osArgs[0]
    } else {
        if len(osArgs) > 1 {
            a.localAddr = osArgs[0]
            a.remoteAddr = osArgs[1]
        } else {
            a.remoteAddr = osArgs[0]
        }
    }

    return a
}

开发者ID:rht,项目名称:ipget,代码行数:28,代码来源:ucat.go

最后编辑: kuteng  文档更新时间: 2021-08-23 19:14   作者:kuteng