本文整理汇总了Golang中github.com/jrperritt/rack/util.Usage函数的典型用法代码示例。如果您正苦于以下问题:Golang Usage函数的具体用法?Golang Usage怎么用?Golang Usage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Usage函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: flagsDeleteMetadata
import (
"fmt"
"strings"
"github.com/jrperritt/rack/commandoptions"
"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 deleteMetadata = cli.Command{
Name: "delete-metadata",
Usage: util.Usage(commandPrefix, "delete-metadata", "--name <objectName> --container <containerName> --metadata-keys <metadataKeys>"),
Description: "Delete specific metadata from the given object.",
Action: actionDeleteMetadata,
Flags: commandoptions.CommandFlags(flagsDeleteMetadata, keysDeleteMetadata),
BashComplete: func(c *cli.Context) {
commandoptions.CompleteFlags(commandoptions.CommandFlags(flagsDeleteMetadata, keysDeleteMetadata))
},
}
func flagsDeleteMetadata() []cli.Flag {
return []cli.Flag{
cli.StringFlag{
Name: "name",
Usage: "[required] The object name from which to delete the metadata.",
},
cli.StringFlag{
开发者ID:harshalhshah,项目名称:rack,代码行数:30,代码来源:deletemetadata.go
示例2: flagsDelete
package securitygroupcommands
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",
开发者ID:flazz,项目名称:rack,代码行数:31,代码来源:delete.go
示例3: flagsDelete
package keypaircommands
import (
"fmt"
"github.com/jrperritt/rack/commandoptions"
"github.com/jrperritt/rack/handler"
"github.com/jrperritt/rack/internal/github.com/codegangsta/cli"
"github.com/jrperritt/rack/internal/github.com/rackspace/gophercloud/rackspace/compute/v2/keypairs"
"github.com/jrperritt/rack/util"
)
var remove = cli.Command{
Name: "delete",
Usage: util.Usage(commandPrefix, "delete", "[--name <keypairName> | --stdin name]"),
Description: "Deletes a keypair",
Action: actionDelete,
Flags: commandoptions.CommandFlags(flagsDelete, keysDelete),
BashComplete: func(c *cli.Context) {
commandoptions.CompleteFlags(commandoptions.CommandFlags(flagsDelete, keysDelete))
},
}
func flagsDelete() []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",
开发者ID:harshalhshah,项目名称:rack,代码行数:31,代码来源:delete.go
示例4: flagsGet
package portcommands
import (
"github.com/jrperritt/rack/handler"
"github.com/jrperritt/rack/internal/github.com/codegangsta/cli"
osPorts "github.com/jrperritt/rack/internal/github.com/rackspace/gophercloud/openstack/networking/v2/ports"
"github.com/jrperritt/rack/internal/github.com/rackspace/gophercloud/rackspace/networking/v2/ports"
"github.com/jrperritt/rack/util"
)
var get = cli.Command{
Name: "get",
Usage: util.Usage(commandPrefix, "get", ""),
Description: "Gets a port",
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 `name` or `stdin` isn't provided] The ID of the port.",
},
cli.StringFlag{
Name: "name",
Usage: "[optional; required if `stdin` or `id` isn't provided] The name of the port.",
},
开发者ID:hdansou,项目名称:rack,代码行数:31,代码来源:get.go
示例5: flagsCreate
package containercommands
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,代码行数:31,代码来源:create.go
示例6: flagsCreate
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 create = cli.Command{
Name: "create",
Usage: util.Usage(commandPrefix, "create", "--size <size>"),
Description: "Creates a volume",
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.IntFlag{
Name: "size",
Usage: "[required] The size of this volume (in gigabytes). Valid values are between 75 and 1024.",
},
cli.StringFlag{
Name: "name",
Usage: "[optional] A name for this volume.",
},
cli.StringFlag{
开发者ID:flazz,项目名称:rack,代码行数:31,代码来源:create.go
示例7: 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
示例8: flagsResize
package instancecommands
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",
开发者ID:flazz,项目名称:rack,代码行数:31,代码来源:resize.go
示例9: flagsUpdate
package subnetcommands
import (
"strings"
"github.com/codegangsta/cli"
"github.com/jrperritt/rack/handler"
"github.com/jrperritt/rack/util"
osSubnets "github.com/rackspace/gophercloud/openstack/networking/v2/subnets"
"github.com/rackspace/gophercloud/rackspace/networking/v2/subnets"
)
var update = cli.Command{
Name: "update",
Usage: util.Usage(commandPrefix, "update", ""),
Description: "Updates a subnet",
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: "[optional; required if `name` isn't provided] The ID of the subnet to update.",
},
cli.StringFlag{
Name: "name",
开发者ID:flazz,项目名称:rack,代码行数:31,代码来源:update.go
示例10: flagsGetMetadata
package instancecommands
import (
"github.com/jrperritt/rack/commandoptions"
"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/util"
)
var getMetadata = cli.Command{
Name: "get-metadata",
Usage: util.Usage(commandPrefix, "get-metadata", ""),
Description: "Get all metadata associated with the given server",
Action: actionGetMetadata,
Flags: commandoptions.CommandFlags(flagsGetMetadata, keysGetMetadata),
BashComplete: func(c *cli.Context) {
commandoptions.CompleteFlags(commandoptions.CommandFlags(flagsGetMetadata, keysGetMetadata))
},
}
func flagsGetMetadata() []cli.Flag {
return []cli.Flag{
cli.StringFlag{
Name: "id",
Usage: "[optional; required if `name` isn't provided] The server ID with the metadata.",
},
cli.StringFlag{
Name: "name",
Usage: "[optional; required if `name` isn't provided] The server name with the metadata.",
开发者ID:harshalhshah,项目名称:rack,代码行数:31,代码来源:getmetadata.go
示例11: flagsCreate
package portcommands
import (
"github.com/jrperritt/rack/handler"
"github.com/jrperritt/rack/internal/github.com/codegangsta/cli"
osPorts "github.com/jrperritt/rack/internal/github.com/rackspace/gophercloud/openstack/networking/v2/ports"
"github.com/jrperritt/rack/internal/github.com/rackspace/gophercloud/rackspace/networking/v2/ports"
"github.com/jrperritt/rack/util"
)
var create = cli.Command{
Name: "create",
Usage: util.Usage(commandPrefix, "create", "--network-id <network-id>"),
Description: "Creates a ports",
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: "network-id",
Usage: "[required] The network ID of the port.",
},
cli.StringFlag{
Name: "name",
Usage: "[optional] The name of the port.",
},
开发者ID:hdansou,项目名称:rack,代码行数:31,代码来源:create.go
示例12: flagsList
package objectcommands
import (
"github.com/jrperritt/rack/commandoptions"
"github.com/jrperritt/rack/handler"
"github.com/jrperritt/rack/internal/github.com/codegangsta/cli"
"github.com/jrperritt/rack/internal/github.com/fatih/structs"
osObjects "github.com/jrperritt/rack/internal/github.com/rackspace/gophercloud/openstack/objectstorage/v1/objects"
"github.com/jrperritt/rack/internal/github.com/rackspace/gophercloud/pagination"
"github.com/jrperritt/rack/internal/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/objects"
"github.com/jrperritt/rack/util"
)
var list = cli.Command{
Name: "list",
Usage: util.Usage(commandPrefix, "list", "[--container <containerName> | --stdin container]"),
Description: "Lists objects in a container",
Action: actionList,
Flags: commandoptions.CommandFlags(flagsList, keysList),
BashComplete: func(c *cli.Context) {
commandoptions.CompleteFlags(commandoptions.CommandFlags(flagsList, keysList))
},
}
func flagsList() []cli.Flag {
return []cli.Flag{
cli.StringFlag{
Name: "container",
Usage: "[optional; required if `stdin` isn't provided] The name of the container",
},
cli.StringFlag{
开发者ID:harshalhshah,项目名称:rack,代码行数:31,代码来源:list.go
示例13: flagsUpdateMetadata
package containercommands
import (
"strings"
"github.com/jrperritt/rack/commandoptions"
"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 updateMetadata = cli.Command{
Name: "update-metadata",
Usage: util.Usage(commandPrefix, "update-metadata", "--name <containerName> --metadata <metadata>"),
Description: "Create or replace metadata for the given container. Any existing metadata will remain in tact.",
Action: actionUpdateMetadata,
Flags: commandoptions.CommandFlags(flagsUpdateMetadata, keysUpdateMetadata),
BashComplete: func(c *cli.Context) {
commandoptions.CompleteFlags(commandoptions.CommandFlags(flagsUpdateMetadata, keysUpdateMetadata))
},
}
func flagsUpdateMetadata() []cli.Flag {
return []cli.Flag{
cli.StringFlag{
Name: "name",
Usage: "[required] The container name with the metadata.",
},
cli.StringFlag{
Name: "metadata",
开发者ID:harshalhshah,项目名称:rack,代码行数:31,代码来源:updatemetadata.go
示例14: flagsCreate
package networkcommands
import (
"github.com/jrperritt/rack/commandoptions"
"github.com/jrperritt/rack/handler"
"github.com/jrperritt/rack/internal/github.com/codegangsta/cli"
osNetworks "github.com/jrperritt/rack/internal/github.com/rackspace/gophercloud/openstack/networking/v2/networks"
"github.com/jrperritt/rack/internal/github.com/rackspace/gophercloud/rackspace/networking/v2/networks"
"github.com/jrperritt/rack/util"
)
var create = cli.Command{
Name: "create",
Usage: util.Usage(commandPrefix, "create", "--name <networkName>"),
Description: "Creates a new networks instance",
Action: actionCreate,
Flags: commandoptions.CommandFlags(flagsCreate, keysCreate),
BashComplete: func(c *cli.Context) {
commandoptions.CompleteFlags(commandoptions.CommandFlags(flagsCreate, keysCreate))
},
}
func flagsCreate() []cli.Flag {
return []cli.Flag{
cli.StringFlag{
Name: "name",
Usage: "[required] The name that the network should have.",
},
cli.StringFlag{
Name: "stdin",
Usage: "[optional] The field being piped into STDIN. Valid values are: name",
开发者ID:harshalhshah,项目名称:rack,代码行数:31,代码来源:create.go
示例15: 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
示例16: flagsDelete
package volumecommands
import (
"fmt"
"github.com/jrperritt/rack/commandoptions"
"github.com/jrperritt/rack/handler"
"github.com/jrperritt/rack/internal/github.com/codegangsta/cli"
osVolumes "github.com/jrperritt/rack/internal/github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumes"
"github.com/jrperritt/rack/util"
)
var remove = cli.Command{
Name: "delete",
Usage: util.Usage(commandPrefix, "delete", "[--id <volumeID> | | --name <volumeName> | --stdin id]"),
Description: "Deletes a volume",
Action: actionDelete,
Flags: commandoptions.CommandFlags(flagsDelete, keysDelete),
BashComplete: func(c *cli.Context) {
commandoptions.CompleteFlags(commandoptions.CommandFlags(flagsDelete, keysDelete))
},
}
func flagsDelete() []cli.Flag {
return []cli.Flag{
cli.StringFlag{
Name: "id",
Usage: "[optional; required if `stdin` or `name` isn't provided] The ID of the volume.",
},
cli.StringFlag{
Name: "name",
开发者ID:harshalhshah,项目名称:rack,代码行数:31,代码来源:delete.go
示例17: flagsGet
package imagecommands
import (
"github.com/jrperritt/rack/handler"
"github.com/jrperritt/rack/internal/github.com/codegangsta/cli"
"github.com/jrperritt/rack/internal/github.com/fatih/structs"
osImages "github.com/jrperritt/rack/internal/github.com/rackspace/gophercloud/openstack/compute/v2/images"
"github.com/jrperritt/rack/internal/github.com/rackspace/gophercloud/rackspace/compute/v2/images"
"github.com/jrperritt/rack/util"
)
var get = cli.Command{
Name: "get",
Usage: util.Usage(commandPrefix, "get", "[--id <serverID> | --name <serverName> | --stdin id]"),
Description: "Retreives an image",
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 image.",
},
cli.StringFlag{
Name: "name",
Usage: "[optional; required if `id` or `stdin` isn't provided] The name of the image.",
开发者ID:hdansou,项目名称:rack,代码行数:31,代码来源:get.go
示例18: flagsCreate
package instancecommands
import (
"io/ioutil"
"strings"
"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 create = cli.Command{
Name: "create",
Usage: util.Usage(commandPrefix, "create", "[--name <instanceName> | --stdin name]"),
Description: "Creates a new server instance",
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 that the instance should have.",
},
cli.StringFlag{
开发者ID:flazz,项目名称:rack,代码行数:31,代码来源:create.go
示例19: flagsCreate
package networkcommands
import (
"github.com/codegangsta/cli"
"github.com/jrperritt/rack/handler"
"github.com/jrperritt/rack/util"
osNetworks "github.com/rackspace/gophercloud/openstack/networking/v2/networks"
"github.com/rackspace/gophercloud/rackspace/networking/v2/networks"
)
var create = cli.Command{
Name: "create",
Usage: util.Usage(commandPrefix, "create", ""),
Description: "Creates a new networks instance",
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] The name that the network should have.",
},
cli.StringFlag{
Name: "stdin",
Usage: "[optional] The field being piped into STDIN. Valid values are: name",
},
开发者ID:flazz,项目名称:rack,代码行数:31,代码来源:create.go
示例20: flagsUpdate
package containercommands
import (
"fmt"
"github.com/jrperritt/rack/commandoptions"
"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 update = cli.Command{
Name: "update",
Usage: util.Usage(commandPrefix, "update", "--name <containerName>"),
Description: "Updates a container",
Action: actionUpdate,
Flags: commandoptions.CommandFlags(flagsUpdate, keysUpdate),
BashComplete: func(c *cli.Context) {
commandoptions.CompleteFlags(commandoptions.CommandFlags(flagsUpdate, keysUpdate))
},
}
func flagsUpdate() []cli.Flag {
return []cli.Flag{
cli.StringFlag{
Name: "name",
Usage: "[required] The name of the container",
},
cli.StringFlag{
Name: "container-read",
开发者ID:harshalhshah,项目名称:rack,代码行数:31,代码来源:update.go
注:本文中的github.com/jrperritt/rack/util.Usage函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论