本文整理汇总了Golang中github.com/jrperritt/rack/util.CommandFlags函数的典型用法代码示例。如果您正苦于以下问题:Golang CommandFlags函数的具体用法?Golang CommandFlags怎么用?Golang CommandFlags使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CommandFlags函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: flagsDownload
import (
"io/ioutil"
"github.com/jrperritt/rack/handler"
"github.com/jrperritt/rack/internal/github.com/codegangsta/cli"
"github.com/jrperritt/rack/internal/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/objects"
"github.com/jrperritt/rack/util"
)
var download = cli.Command{
Name: "download",
Usage: util.Usage(commandPrefix, "download", "--container <containerName> --name <objectName>"),
Description: "Downloads an object",
Action: actionDownload,
Flags: util.CommandFlags(flagsDownload, keysDownload),
BashComplete: func(c *cli.Context) {
util.CompleteFlags(util.CommandFlags(flagsDownload, keysDownload))
},
}
func flagsDownload() []cli.Flag {
return []cli.Flag{
cli.StringFlag{
Name: "container",
Usage: "[required] The name of the container containing the object to download",
},
cli.StringFlag{
Name: "name",
Usage: "[required] The name of the object to download",
},
开发者ID:mrhillsman,项目名称:rack,代码行数:30,代码来源:download.go
示例2: flagsGet
package snapshotcommands
import (
"github.com/jrperritt/rack/handler"
"github.com/jrperritt/rack/internal/github.com/codegangsta/cli"
osSnapshots "github.com/jrperritt/rack/internal/github.com/rackspace/gophercloud/openstack/blockstorage/v1/snapshots"
"github.com/jrperritt/rack/util"
)
var get = cli.Command{
Name: "get",
Usage: util.Usage(commandPrefix, "get", "[--id <snapshotID> | --name <snapshotName> | --stdin id]"),
Description: "Gets a snapshot",
Action: actionGet,
Flags: util.CommandFlags(flagsGet, keysGet),
BashComplete: func(c *cli.Context) {
util.CompleteFlags(util.CommandFlags(flagsGet, keysGet))
},
}
func flagsGet() []cli.Flag {
return []cli.Flag{
cli.StringFlag{
Name: "id",
Usage: "[optional; required if `stdin` or `name` isn't provided] The ID of the snapshot.",
},
cli.StringFlag{
Name: "name",
Usage: "[optional; required if `stdin` or `id` isn't provided] The name of the snapshot.",
},
cli.StringFlag{
开发者ID:hdansou,项目名称:rack,代码行数:31,代码来源:get.go
示例3: flagsList
import (
"github.com/jrperritt/rack/handler"
"github.com/jrperritt/rack/internal/github.com/codegangsta/cli"
"github.com/jrperritt/rack/internal/github.com/fatih/structs"
osContainers "github.com/jrperritt/rack/internal/github.com/rackspace/gophercloud/openstack/objectstorage/v1/containers"
"github.com/jrperritt/rack/internal/github.com/rackspace/gophercloud/pagination"
"github.com/jrperritt/rack/internal/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/containers"
"github.com/jrperritt/rack/util"
)
var list = cli.Command{
Name: "list",
Usage: util.Usage(commandPrefix, "list", ""),
Description: "Lists containers",
Action: actionList,
Flags: util.CommandFlags(flagsList, keysList),
BashComplete: func(c *cli.Context) {
util.CompleteFlags(util.CommandFlags(flagsList, keysList))
},
}
func flagsList() []cli.Flag {
return []cli.Flag{
cli.BoolFlag{
Name: "all-pages",
Usage: "[optional] Return all containers. Default is to paginate.",
},
cli.StringFlag{
Name: "prefix",
Usage: "[optional] Only return containers with this prefix.",
},
开发者ID:hdansou,项目名称:rack,代码行数:31,代码来源:list.go
示例4: flagsDelete
import (
"fmt"
"github.com/codegangsta/cli"
"github.com/jrperritt/rack/handler"
"github.com/jrperritt/rack/util"
osSecurityGroups "github.com/rackspace/gophercloud/openstack/networking/v2/extensions/security/groups"
securityGroups "github.com/rackspace/gophercloud/rackspace/networking/v2/security/groups"
)
var remove = cli.Command{
Name: "delete",
Usage: util.Usage(commandPrefix, "delete", ""),
Description: "Deletes an existing security group",
Action: actionDelete,
Flags: util.CommandFlags(flagsDelete, keysDelete),
BashComplete: func(c *cli.Context) {
util.CompleteFlags(util.CommandFlags(flagsDelete, keysDelete))
},
}
func flagsDelete() []cli.Flag {
return []cli.Flag{
cli.StringFlag{
Name: "id",
Usage: "[optional; required if `name` or `stdin` isn't provided] The ID of the security group.",
},
cli.StringFlag{
Name: "name",
Usage: "[optional; required if `stdin` or `id` isn't provided] The name of the security group.",
},
开发者ID:flazz,项目名称:rack,代码行数:31,代码来源:delete.go
示例5: flagsUpdate
package volumecommands
import (
"github.com/codegangsta/cli"
"github.com/jrperritt/rack/handler"
"github.com/jrperritt/rack/util"
osVolumes "github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumes"
)
var update = cli.Command{
Name: "update",
Usage: util.Usage(commandPrefix, "update", "--id <volumeID>"),
Description: "Updates a volume",
Action: actionUpdate,
Flags: util.CommandFlags(flagsUpdate, keysUpdate),
BashComplete: func(c *cli.Context) {
util.CompleteFlags(util.CommandFlags(flagsUpdate, keysUpdate))
},
}
func flagsUpdate() []cli.Flag {
return []cli.Flag{
cli.StringFlag{
Name: "id",
Usage: "[required] The ID of the volume to update.",
},
cli.StringFlag{
Name: "rename",
Usage: "[optional] A new name for this volume.",
},
cli.StringFlag{
开发者ID:flazz,项目名称:rack,代码行数:31,代码来源:update.go
示例6: flagsCreate
import (
"fmt"
"github.com/jrperritt/rack/handler"
"github.com/jrperritt/rack/internal/github.com/codegangsta/cli"
"github.com/jrperritt/rack/internal/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/containers"
"github.com/jrperritt/rack/util"
)
var get = cli.Command{
Name: "create",
Usage: util.Usage(commandPrefix, "create", "[--name <containerName> | --stdin name]"),
Description: "Creates a container",
Action: actionCreate,
Flags: util.CommandFlags(flagsCreate, keysCreate),
BashComplete: func(c *cli.Context) {
util.CompleteFlags(util.CommandFlags(flagsCreate, keysCreate))
},
}
func flagsCreate() []cli.Flag {
return []cli.Flag{
cli.StringFlag{
Name: "name",
Usage: "[optional; required if `stdin` isn't provided] The name of the container",
},
cli.StringFlag{
Name: "stdin",
Usage: "[optional; required if `name` isn't provided] The field being piped into STDIN. Valid values are: name",
},
开发者ID:hdansou,项目名称:rack,代码行数:30,代码来源:create.go
示例7: flagsRebuild
package instancecommands
import (
"github.com/codegangsta/cli"
"github.com/jrperritt/rack/handler"
"github.com/jrperritt/rack/util"
osServers "github.com/rackspace/gophercloud/openstack/compute/v2/servers"
"github.com/rackspace/gophercloud/rackspace/compute/v2/servers"
)
var rebuild = cli.Command{
Name: "rebuild",
Usage: util.Usage(commandPrefix, "rebuild", "[--id <serverID>|--name <serverName>] --image-id <image-id> --admin-pass <admin-pass>"),
Description: "Rebuilds an existing server",
Action: actionRebuild,
Flags: util.CommandFlags(flagsRebuild, keysGet),
BashComplete: func(c *cli.Context) {
util.CompleteFlags(util.CommandFlags(flagsRebuild, keysGet))
},
}
func flagsRebuild() []cli.Flag {
return []cli.Flag{
cli.StringFlag{
Name: "id",
Usage: "[optional; required if `name` isn't provided] The ID of the server.",
},
cli.StringFlag{
Name: "name",
Usage: "[optional; required if `id` isn't provided] The name of the server.",
},
开发者ID:flazz,项目名称:rack,代码行数:31,代码来源:rebuild.go
示例8: flagsUpload
"os"
"strings"
"github.com/jrperritt/rack/handler"
"github.com/jrperritt/rack/internal/github.com/codegangsta/cli"
osObjects "github.com/jrperritt/rack/internal/github.com/rackspace/gophercloud/openstack/objectstorage/v1/objects"
"github.com/jrperritt/rack/internal/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/objects"
"github.com/jrperritt/rack/util"
)
var upload = cli.Command{
Name: "upload",
Usage: util.Usage(commandPrefix, "upload", "--container <containerName> --name <objectName>"),
Description: "Uploads an object",
Action: actionUpload,
Flags: util.CommandFlags(flagsUpload, keysUpload),
BashComplete: func(c *cli.Context) {
util.CompleteFlags(util.CommandFlags(flagsUpload, keysUpload))
},
}
func flagsUpload() []cli.Flag {
return []cli.Flag{
cli.StringFlag{
Name: "container",
Usage: "[required] The name of the container to upload the object upload",
},
cli.StringFlag{
Name: "name",
Usage: "[required] The name the object should have in the Cloud Files container",
},
开发者ID:mrhillsman,项目名称:rack,代码行数:31,代码来源:upload.go
示例9: flagsResize
import (
"fmt"
"github.com/codegangsta/cli"
"github.com/jrperritt/rack/handler"
"github.com/jrperritt/rack/util"
osServers "github.com/rackspace/gophercloud/openstack/compute/v2/servers"
"github.com/rackspace/gophercloud/rackspace/compute/v2/servers"
)
var resize = cli.Command{
Name: "resize",
Usage: util.Usage(commandPrefix, "resize", "[--id <serverID>|--name <serverName>|--stdin id] --flavor-id <flavor-id>"),
Description: "Resizes an existing server",
Action: actionResize,
Flags: util.CommandFlags(flagsResize, keysResize),
BashComplete: func(c *cli.Context) {
util.CompleteFlags(util.CommandFlags(flagsResize, keysResize))
},
}
func flagsResize() []cli.Flag {
return []cli.Flag{
cli.StringFlag{
Name: "flavor-id",
Usage: "[required] The ID of the flavor that the resized server should have.",
},
cli.StringFlag{
Name: "id",
Usage: "[optional; required if `stdin` or `name` isn't provided] The ID of the server.",
},
开发者ID:flazz,项目名称:rack,代码行数:31,代码来源:resize.go
示例10: flagsReboot
"fmt"
"github.com/jrperritt/rack/handler"
"github.com/jrperritt/rack/internal/github.com/codegangsta/cli"
osServers "github.com/jrperritt/rack/internal/github.com/rackspace/gophercloud/openstack/compute/v2/servers"
"github.com/jrperritt/rack/internal/github.com/rackspace/gophercloud/rackspace/compute/v2/servers"
"github.com/jrperritt/rack/output"
"github.com/jrperritt/rack/util"
)
var reboot = cli.Command{
Name: "reboot",
Usage: util.Usage(commandPrefix, "reboot", "[--id <serverID> | --name <serverName> | --stdin id] [--soft | --hard]"),
Description: "Reboots an existing server",
Action: actionReboot,
Flags: util.CommandFlags(flagsReboot, keysReboot),
BashComplete: func(c *cli.Context) {
util.CompleteFlags(util.CommandFlags(flagsReboot, keysReboot))
},
}
func flagsReboot() []cli.Flag {
return []cli.Flag{
cli.BoolFlag{
Name: "soft",
Usage: "[optional; required if 'hard' is not provided] Ask the OS to restart under its own procedures.",
},
cli.BoolFlag{
Name: "hard",
Usage: "[optional; required if 'soft' is not provided] Physically cut power to the machine and then restore it after a brief while.",
},
开发者ID:hdansou,项目名称:rack,代码行数:31,代码来源:reboot.go
示例11: flagsGenerate
"strings"
"github.com/jrperritt/rack/handler"
"github.com/jrperritt/rack/internal/github.com/codegangsta/cli"
"github.com/jrperritt/rack/internal/github.com/fatih/structs"
osKeypairs "github.com/jrperritt/rack/internal/github.com/rackspace/gophercloud/openstack/compute/v2/extensions/keypairs"
"github.com/jrperritt/rack/internal/github.com/rackspace/gophercloud/rackspace/compute/v2/keypairs"
"github.com/jrperritt/rack/util"
)
var generate = cli.Command{
Name: "generate",
Usage: util.Usage(commandPrefix, "generate", "[--name <keypairName> | --stdin name]"),
Description: "Generates a keypair",
Action: actionGenerate,
Flags: util.CommandFlags(flagsGenerate, keysGenerate),
BashComplete: func(c *cli.Context) {
util.CompleteFlags(util.CommandFlags(flagsGenerate, keysGenerate))
},
}
func flagsGenerate() []cli.Flag {
return []cli.Flag{
cli.StringFlag{
Name: "name",
Usage: "[optional; required if `stdin` isn't provided] The name of the keypair",
},
cli.StringFlag{
Name: "stdin",
Usage: "[optional; required if `name` isn't provided] The field being piped into STDIN. Valid values are: name",
},
开发者ID:hdansou,项目名称:rack,代码行数:31,代码来源:generate.go
注:本文中的github.com/jrperritt/rack/util.CommandFlags函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论