本文整理汇总了Golang中github.com/rackspace/rack/util.Usage函数的典型用法代码示例。如果您正苦于以下问题:Golang Usage函数的具体用法?Golang Usage怎么用?Golang Usage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Usage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: flagsListAddressesByNetwork
package instancecommands
import (
"github.com/rackspace/rack/commandoptions"
"github.com/rackspace/rack/handler"
"github.com/rackspace/rack/internal/github.com/codegangsta/cli"
osServers "github.com/rackspace/rack/internal/github.com/rackspace/gophercloud/openstack/compute/v2/servers"
"github.com/rackspace/rack/internal/github.com/rackspace/gophercloud/pagination"
"github.com/rackspace/rack/internal/github.com/rackspace/gophercloud/rackspace/compute/v2/servers"
"github.com/rackspace/rack/util"
)
var listAddressesByNetwork = cli.Command{
Name: "list-addresses-by-network",
Usage: util.Usage(commandPrefix, "list-addresses-by-network", "--network <networkType> [--id <serverID> | --name <serverName> | --stdin id]"),
Description: "Lists existing IP addresses for the given server and network",
Action: actionListAddressesByNetwork,
Flags: commandoptions.CommandFlags(flagsListAddressesByNetwork, keysListAddressesByNetwork),
BashComplete: func(c *cli.Context) {
commandoptions.CompleteFlags(commandoptions.CommandFlags(flagsListAddressesByNetwork, keysListAddressesByNetwork))
},
}
func flagsListAddressesByNetwork() []cli.Flag {
return []cli.Flag{
cli.StringFlag{
Name: "network",
Usage: "[required] The network for which to list the IP addresses.",
},
cli.StringFlag{
Name: "id",
示例2: flagsGetTemplate
package stackcommands
import (
"github.com/rackspace/rack/commandoptions"
"github.com/rackspace/rack/handler"
"github.com/rackspace/rack/internal/github.com/codegangsta/cli"
"github.com/rackspace/rack/internal/github.com/rackspace/gophercloud/rackspace/orchestration/v1/stacktemplates"
"github.com/rackspace/rack/util"
)
var getTemplate = cli.Command{
Name: "get-template",
Usage: util.Usage(commandPrefix, "get-template", "[--name <stackName> | --id <stackID> | --stdin name]"),
Description: "Get template for specified stack",
Action: actionGetTemplate,
Flags: commandoptions.CommandFlags(flagsGetTemplate, keysGetTemplate),
BashComplete: func(c *cli.Context) {
commandoptions.CompleteFlags(commandoptions.CommandFlags(flagsGetTemplate, keysGetTemplate))
},
}
func flagsGetTemplate() []cli.Flag {
return []cli.Flag{
cli.StringFlag{
Name: "name",
Usage: "[optional; required if neither `id` nor `stdin` is provided] The stack name.",
},
cli.StringFlag{
Name: "id",
Usage: "[optional; required if neither `name` nor `stdin` is provided] The stack id.",
},
示例3: flagsUpdate
package containercommands
import (
"fmt"
"github.com/rackspace/rack/commandoptions"
"github.com/rackspace/rack/handler"
"github.com/rackspace/rack/internal/github.com/codegangsta/cli"
"github.com/rackspace/rack/internal/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/containers"
"github.com/rackspace/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",
示例4: flagsGet
package imagecommands
import (
"github.com/rackspace/rack/commandoptions"
"github.com/rackspace/rack/handler"
"github.com/rackspace/rack/internal/github.com/codegangsta/cli"
"github.com/rackspace/rack/internal/github.com/fatih/structs"
osImages "github.com/rackspace/rack/internal/github.com/rackspace/gophercloud/openstack/compute/v2/images"
"github.com/rackspace/rack/internal/github.com/rackspace/gophercloud/rackspace/compute/v2/images"
"github.com/rackspace/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: commandoptions.CommandFlags(flagsGet, keysGet),
BashComplete: func(c *cli.Context) {
commandoptions.CompleteFlags(commandoptions.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",
示例5: flagsList
package securitygroupcommands
import (
"github.com/rackspace/rack/commandoptions"
"github.com/rackspace/rack/handler"
"github.com/rackspace/rack/internal/github.com/codegangsta/cli"
osSecurityGroups "github.com/rackspace/rack/internal/github.com/rackspace/gophercloud/openstack/networking/v2/extensions/security/groups"
"github.com/rackspace/rack/internal/github.com/rackspace/gophercloud/pagination"
securityGroups "github.com/rackspace/rack/internal/github.com/rackspace/gophercloud/rackspace/networking/v2/security/groups"
"github.com/rackspace/rack/util"
)
var list = cli.Command{
Name: "list",
Usage: util.Usage(commandPrefix, "list", ""),
Description: "Lists existing security groups",
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.BoolFlag{
Name: "all-pages",
Usage: "[optional] Return all security groups. Default is to paginate.",
},
cli.StringFlag{
Name: "name",
示例6: flagsCreate
package volumecommands
import (
"github.com/rackspace/rack/commandoptions"
"github.com/rackspace/rack/handler"
"github.com/rackspace/rack/internal/github.com/codegangsta/cli"
osVolumes "github.com/rackspace/rack/internal/github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumes"
"github.com/rackspace/rack/util"
)
var create = cli.Command{
Name: "create",
Usage: util.Usage(commandPrefix, "create", "--size <size>"),
Description: "Creates a volume",
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.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.",
},
示例7: flagsResize
package instancecommands
import (
"fmt"
"github.com/rackspace/rack/commandoptions"
"github.com/rackspace/rack/handler"
"github.com/rackspace/rack/internal/github.com/codegangsta/cli"
osServers "github.com/rackspace/rack/internal/github.com/rackspace/gophercloud/openstack/compute/v2/servers"
"github.com/rackspace/rack/internal/github.com/rackspace/gophercloud/rackspace/compute/v2/servers"
"github.com/rackspace/rack/util"
)
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: commandoptions.CommandFlags(flagsResize, keysResize),
BashComplete: func(c *cli.Context) {
commandoptions.CompleteFlags(commandoptions.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{
示例8: flagsDelete
package portcommands
import (
"fmt"
"github.com/rackspace/rack/commandoptions"
"github.com/rackspace/rack/handler"
"github.com/rackspace/rack/internal/github.com/codegangsta/cli"
osPorts "github.com/rackspace/rack/internal/github.com/rackspace/gophercloud/openstack/networking/v2/ports"
"github.com/rackspace/rack/internal/github.com/rackspace/gophercloud/rackspace/networking/v2/ports"
"github.com/rackspace/rack/util"
)
var remove = cli.Command{
Name: "delete",
Usage: util.Usage(commandPrefix, "delete", "[--id <portID> | --name <portName> | --stdin id]"),
Description: "Deletes a port",
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 `name` or `stdin` isn't provided] The ID of the port to delete.",
},
cli.StringFlag{
示例9: flagsUpload
"runtime"
"strings"
"time"
"github.com/rackspace/rack/commandoptions"
"github.com/rackspace/rack/commands/filescommands/objectcommands"
"github.com/rackspace/rack/handler"
"github.com/rackspace/rack/internal/github.com/codegangsta/cli"
"github.com/rackspace/rack/internal/github.com/dustin/go-humanize"
osObjects "github.com/rackspace/rack/internal/github.com/rackspace/gophercloud/openstack/objectstorage/v1/objects"
"github.com/rackspace/rack/util"
)
var upload = cli.Command{
Name: "upload",
Usage: util.Usage(commandPrefix, "upload", "--container <containerName> --size-pieces <sizePieces> [--name <objectName> | --stdin file]"),
Description: "Uploads a large object",
Action: actionUpload,
Flags: commandoptions.CommandFlags(flagsUpload, keysUpload),
BashComplete: func(c *cli.Context) {
commandoptions.CompleteFlags(commandoptions.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 into.",
},
cli.StringFlag{
示例10: flagsUpload
"fmt"
"io"
"os"
"strings"
"github.com/rackspace/rack/commandoptions"
"github.com/rackspace/rack/handler"
"github.com/rackspace/rack/internal/github.com/codegangsta/cli"
osObjects "github.com/rackspace/rack/internal/github.com/rackspace/gophercloud/openstack/objectstorage/v1/objects"
"github.com/rackspace/rack/internal/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/objects"
"github.com/rackspace/rack/util"
)
var upload = cli.Command{
Name: "upload",
Usage: util.Usage(commandPrefix, "upload", "--container <containerName> --name <objectName>"),
Description: "Uploads an object",
Action: actionUpload,
Flags: commandoptions.CommandFlags(flagsUpload, keysUpload),
BashComplete: func(c *cli.Context) {
commandoptions.CompleteFlags(commandoptions.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 into.",
},
cli.StringFlag{
示例11: flagsCreate
package snapshotcommands
import (
"github.com/rackspace/rack/commandoptions"
"github.com/rackspace/rack/handler"
"github.com/rackspace/rack/internal/github.com/codegangsta/cli"
osSnapshots "github.com/rackspace/rack/internal/github.com/rackspace/gophercloud/openstack/blockstorage/v1/snapshots"
"github.com/rackspace/rack/util"
)
var create = cli.Command{
Name: "create",
Usage: util.Usage(commandPrefix, "create", "--volume-id <volumeID>"),
Description: "Creates a volume",
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: "volume-id",
Usage: "[required] The volume ID from which to create this snapshot.",
},
cli.StringFlag{
Name: "name",
Usage: "[optional] A name for this snapshot.",
},
示例12: flagsSetMetadata
package instancecommands
import (
"github.com/rackspace/rack/commandoptions"
"github.com/rackspace/rack/handler"
"github.com/rackspace/rack/internal/github.com/codegangsta/cli"
osServers "github.com/rackspace/rack/internal/github.com/rackspace/gophercloud/openstack/compute/v2/servers"
"github.com/rackspace/rack/util"
)
var setMetadata = cli.Command{
Name: "set-metadata",
Usage: util.Usage(commandPrefix, "set-metadata", ""),
Description: "Set metadata for the given server. This will erase any current metadata.",
Action: actionSetMetadata,
Flags: commandoptions.CommandFlags(flagsSetMetadata, keysSetMetadata),
BashComplete: func(c *cli.Context) {
commandoptions.CompleteFlags(commandoptions.CommandFlags(flagsSetMetadata, keysSetMetadata))
},
}
func flagsSetMetadata() []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.",
},
示例13: flagsListEvents
import (
"strings"
"github.com/rackspace/rack/commandoptions"
"github.com/rackspace/rack/handler"
"github.com/rackspace/rack/internal/github.com/codegangsta/cli"
"github.com/rackspace/rack/internal/github.com/fatih/structs"
osStackEvents "github.com/rackspace/rack/internal/github.com/rackspace/gophercloud/openstack/orchestration/v1/stackevents"
"github.com/rackspace/rack/internal/github.com/rackspace/gophercloud/rackspace/orchestration/v1/stackevents"
"github.com/rackspace/rack/util"
)
var listEvents = cli.Command{
Name: "list-events",
Usage: util.Usage(commandPrefix, "list-events", "[--name <stackName> | --id <stackID> | --stdin name]"),
Description: "Lists events for a specified stack",
Action: actionListEvents,
Flags: commandoptions.CommandFlags(flagsListEvents, keysListEvents),
BashComplete: func(c *cli.Context) {
commandoptions.CompleteFlags(commandoptions.CommandFlags(flagsListEvents, keysListEvents))
},
}
func flagsListEvents() []cli.Flag {
return []cli.Flag{
cli.StringFlag{
Name: "name",
Usage: "[optional; required if neither `id` nor `stdin` is provided] The stack name.",
},
cli.StringFlag{
示例14: flagsDeleteMetadata
import (
"fmt"
"strings"
"github.com/rackspace/rack/commandoptions"
"github.com/rackspace/rack/handler"
"github.com/rackspace/rack/internal/github.com/codegangsta/cli"
osObjects "github.com/rackspace/rack/internal/github.com/rackspace/gophercloud/openstack/objectstorage/v1/objects"
"github.com/rackspace/rack/internal/github.com/rackspace/gophercloud/rackspace/objectstorage/v1/objects"
"github.com/rackspace/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{
示例15: flagsCreate
package imagecommands
import (
"github.com/rackspace/rack/commandoptions"
"github.com/rackspace/rack/handler"
"github.com/rackspace/rack/internal/github.com/codegangsta/cli"
osServers "github.com/rackspace/rack/internal/github.com/rackspace/gophercloud/openstack/compute/v2/servers"
"github.com/rackspace/rack/util"
)
var create = cli.Command{
Name: "create",
Usage: util.Usage(commandPrefix, "create", "--name <imageName> [--server-id <serverID> | --server-name <serverName>]"),
Description: "Creates an image from a server 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 the created image will have",
},
cli.StringFlag{
Name: "server-id",
Usage: "[optional; required if `server-name` isn't provided] The ID of the server from which to create the image",
},