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

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

示例1: main

func main() {
    flag.Parse()

    if email == "" || password == "" {
        fmt.Println("Invalid E-Mail or Password\n")
        flag.Usage()
        os.Exit(-1)
    }

    if flag.NArg()%2 == 0 {
        flag.Usage()
        os.Exit(-1)
    }
    imsi := flag.Arg(0)
    tags := make([]map[string]string, (flag.NArg()-1)/2)
    idx := 0
    for i := 1; i < flag.NArg(); i += 2 {
        k := flag.Arg(i)
        v := flag.Arg(i + 1)
        tag := map[string]string{"tagName": k, "tagValue": v}
        tags[idx] = tag
        idx++
    }
    fmt.Println(tags)

    c, err := goracom.NewClient(email, password)
    errToExit(err)
    s := c.NewSubscriber()
    sub, err := s.Tags(imsi, tags)
    errToExit(err)
    printSubscriber(*sub)
}

开发者ID:135yshr,项目名称:goracom,代码行数:32,代码来源:set_tag.go

示例2: main

func main() {
    // Scans the arg list and sets up flags
    debug := flag.Bool("debug", false, "print debugging messages.")
    latencies := flag.Bool("latencies", false, "record operation latencies.")

    flag.Parse()
    if flag.NArg() < 2 {
        fmt.Fprintf(os.Stderr, "usage: %s MOUNTPOINT ZIP-FILE\n", os.Args[0])
        os.Exit(2)
    }

    var fs fuse.NodeFileSystem
    fs, err := zipfs.NewArchiveFileSystem(flag.Arg(1))
    if err != nil {
        fmt.Fprintf(os.Stderr, "NewArchiveFileSystem failed: %v\n", err)
        os.Exit(1)
    }

    state, _, err := fuse.MountNodeFileSystem(flag.Arg(0), fs, nil)
    if err != nil {
        fmt.Printf("Mount fail: %v\n", err)
        os.Exit(1)
    }

    state.SetRecordStatistics(*latencies)
    state.Debug = *debug
    state.Loop()
}

开发者ID:CloudLife,项目名称:go-fuse,代码行数:28,代码来源:main.go

示例3: main

func main() {
    var acctAlias = flag.String("a", "", "Account alias to use")

    flag.Usage = func() {
        fmt.Fprintf(os.Stderr, "usage: %s [options]  <HW Group UUID>\n", path.Base(os.Args[0]))
        flag.PrintDefaults()
    }

    flag.Parse()
    if flag.NArg() != 1 {
        flag.Usage()
        os.Exit(1)
    }

    client, err := clcv1.NewClient(log.New(os.Stdout, "", log.LstdFlags|log.Ltime))
    if err != nil {
        exit.Fatal(err.Error())
    } else if err := client.Logon("", ""); err != nil {
        exit.Fatalf("Login failed: %s", err)
    }

    reqId, err := client.ArchiveHardwareGroup(flag.Arg(0), *acctAlias)
    if err != nil {
        exit.Fatalf("Failed to archive Hardware Group %s: %s", flag.Arg(0), err)
    }

    fmt.Println("Request ID for group archival:", reqId)
}

开发者ID:grrtrr,项目名称:clcv1,代码行数:28,代码来源:archive.go

示例4: main

func main() {
    flag.Parse()

    if email == "" || password == "" {
        fmt.Println("Invalid E-Mail or Password\n")
        flag.Usage()
        os.Exit(-1)
    }

    if flag.NArg() != 2 {
        flag.Usage()
        os.Exit(-1)
    }
    imsi := flag.Arg(0)
    speed := flag.Arg(1)

    c, err := goracom.NewClient(email, password)
    errToExit(err)
    s := c.NewSubscriber()

    if sub, err := s.UpdateSpeedClass(imsi, speed); err == nil {
        printSubscriber(*sub)
    } else {
        errToExit(err)
    }
}

开发者ID:135yshr,项目名称:goracom,代码行数:26,代码来源:update_speed.go

示例5: main

func main() {
    flag.Parse()
    root := flag.Arg(0)
    bucket = flag.Arg(1)
    conf = flag.Arg(2)
    filepath.Walk(root, walkpath)
}

开发者ID:cyarie,项目名称:suchgopcandidatewow.com,代码行数:7,代码来源:uploader.go

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