本文整理匯總了Golang中github.com/cloudfoundry/cli/cf/flag_helpers.NewStringFlag函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewStringFlag函數的具體用法?Golang NewStringFlag怎麽用?Golang NewStringFlag使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了NewStringFlag函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Metadata
func (cmd *Push) Metadata() command_metadata.CommandMetadata {
return command_metadata.CommandMetadata{
Name: "push",
ShortName: "p",
Description: T("Push a new app or sync changes to an existing app"),
Usage: T("Push a single app (with or without a manifest):\n") + T(" CF_NAME push APP [-b BUILDPACK_NAME] [-c COMMAND] [-d DOMAIN] [-f MANIFEST_PATH]\n") + T(" [-i NUM_INSTANCES] [-k DISK] [-m MEMORY] [-n HOST] [-p PATH] [-s STACK] [-t TIMEOUT]\n") +
" [--no-hostname] [--no-manifest] [--no-route] [--no-start]\n" +
"\n" + T(" Push multiple apps with a manifest:\n") + T(" CF_NAME push [-f MANIFEST_PATH]\n"),
Flags: []cli.Flag{
flag_helpers.NewStringFlag("b", T("Custom buildpack by name (e.g. my-buildpack) or GIT URL (e.g. https://github.com/heroku/heroku-buildpack-play.git)")),
flag_helpers.NewStringFlag("c", T("Startup command, set to null to reset to default start command")),
flag_helpers.NewStringFlag("d", T("Domain (e.g. example.com)")),
flag_helpers.NewStringFlag("f", T("Path to manifest")),
flag_helpers.NewIntFlag("i", T("Number of instances")),
flag_helpers.NewStringFlag("k", T("Disk limit (e.g. 256M, 1024M, 1G)")),
flag_helpers.NewStringFlag("m", T("Memory limit (e.g. 256M, 1024M, 1G)")),
flag_helpers.NewStringFlag("n", T("Hostname (e.g. my-subdomain)")),
flag_helpers.NewStringFlag("p", T("Path to app directory or file")),
flag_helpers.NewStringFlag("s", T("Stack to use (a stack is a pre-built file system, including an operating system, that can run apps)")),
flag_helpers.NewStringFlag("t", T("Start timeout in seconds")),
cli.BoolFlag{Name: "no-hostname", Usage: T("Map the root domain to this app")},
cli.BoolFlag{Name: "no-manifest", Usage: T("Ignore manifest file")},
cli.BoolFlag{Name: "no-route", Usage: T("Do not map a route to this app")},
cli.BoolFlag{Name: "no-start", Usage: T("Do not start an app after pushing")},
cli.BoolFlag{Name: "random-route", Usage: T("Create a random route for this app")},
},
}
}
示例2: Metadata
func (cmd CreateUserProvidedService) Metadata() command_metadata.CommandMetadata {
return command_metadata.CommandMetadata{
Name: "create-user-provided-service",
ShortName: "cups",
Description: T("Make a user-provided service instance available to cf apps"),
Usage: T(`CF_NAME create-user-provided-service SERVICE_INSTANCE [-p CREDENTIALS] [-l SYSLOG-DRAIN-URL]
Pass comma separated credential parameter names to enable interactive mode:
CF_NAME create-user-provided-service SERVICE_INSTANCE -p "comma, separated, parameter, names"
Pass credential parameters as JSON to create a service non-interactively:
CF_NAME create-user-provided-service SERVICE_INSTANCE -p '{"name":"value","name":"value"}'
EXAMPLE
CF_NAME create-user-provided-service my-db-mine -p "username, password"
CF_NAME create-user-provided-service my-drain-service -l syslog://example.com
Linux/Mac:
CF_NAME create-user-provided-service my-db-mine -p '{"username":"admin","password":"pa55woRD"}'
Windows Command Line
CF_NAME create-user-provided-service my-db-mine -p "{\"username\":\"admin\",\"password\":\"pa55woRD\"}"
Windows PowerShell
CF_NAME create-user-provided-service my-db-mine -p '{\"username\":\"admin\",\"password\":\"pa55woRD\"}'
`),
Flags: []cli.Flag{
flag_helpers.NewStringFlag("p", T("Credentials")),
flag_helpers.NewStringFlag("l", T("Syslog Drain Url")),
},
}
}
示例3: Metadata
func (cmd *UpdateService) Metadata() command_metadata.CommandMetadata {
baseUsage := T("CF_NAME update-service SERVICE_INSTANCE [-p NEW_PLAN] [-c PARAMETERS_AS_JSON] [-t TAGS]")
paramsUsage := T(` Optionally provide service-specific configuration parameters in a valid JSON object in-line.
CF_NAME update-service -c '{"name":"value","name":"value"}'
Optionally provide a file containing service-specific configuration parameters in a valid JSON object.
The path to the parameters file can be an absolute or relative path to a file.
CF_NAME update-service -c PATH_TO_FILE
Example of valid JSON object:
{
"cluster_nodes": {
"count": 5,
"memory_mb": 1024
}
}`)
tagsUsage := T(` Optionally provide a list of comma-delimited tags that will be written to the VCAP_SERVICES environment variable for any bound applications.`)
exampleUsage := T(`EXAMPLE:
CF_NAME update-service mydb -p gold
CF_NAME update-service mydb -c '{"ram_gb":4}'
CF_NAME update-service mydb -c ~/workspace/tmp/instance_config.json
CF_NAME update-service mydb -t "list,of, tags"`)
return command_metadata.CommandMetadata{
Name: "update-service",
Description: T("Update a service instance"),
Usage: T(strings.Join([]string{baseUsage, paramsUsage, tagsUsage, exampleUsage}, "\n\n")),
Flags: []cli.Flag{
flag_helpers.NewStringFlag("p", T("Change service plan for a service instance")),
flag_helpers.NewStringFlag("c", T("Valid JSON object containing service-specific configuration parameters, provided either in-line or in a file. For a list of supported configuration parameters, see documentation for the particular service offering.")),
flag_helpers.NewStringFlag("t", T("User provided tags")),
},
}
}
示例4: Metadata
func (cmd *EnableServiceAccess) Metadata() command_metadata.CommandMetadata {
return command_metadata.CommandMetadata{
Name: "enable-service-access",
Description: T("Enable access to a service or service plan for one or all orgs"),
Usage: "CF_NAME enable-service-access SERVICE [-p PLAN] [-o ORG]",
Flags: []cli.Flag{
flag_helpers.NewStringFlag("p", T("Enable access to a specified service plan")),
flag_helpers.NewStringFlag("o", T("Enable access for a specified organization")),
},
}
}
示例5: Metadata
func (cmd CreateSpace) Metadata() command_metadata.CommandMetadata {
return command_metadata.CommandMetadata{
Name: "create-space",
Description: T("Create a space"),
Usage: T("CF_NAME create-space SPACE [-o ORG] [-q SPACE-QUOTA]"),
Flags: []cli.Flag{
flag_helpers.NewStringFlag("o", T("Organization")),
flag_helpers.NewStringFlag("q", T("Quota to assign to the newly created space (excluding this option results in assignment of default quota)")),
},
}
}
示例6: Metadata
func (cmd UpdateServiceBroker) Metadata() command_metadata.CommandMetadata {
return command_metadata.CommandMetadata{
Name: "update-service-broker",
Description: T("Update a service broker"),
Usage: T("CF_NAME update-service-broker SERVICE_BROKER [-u USERNAME] [-p PASSWORD] [--url URL]"),
Flags: []cli.Flag{
flag_helpers.NewStringFlag("u", T("Username")),
flag_helpers.NewStringFlag("p", T("Password")),
flag_helpers.NewStringFlag("url", T("URL")),
},
}
}
示例7: Metadata
func (cmd *CopySource) Metadata() command_metadata.CommandMetadata {
return command_metadata.CommandMetadata{
Name: "copy-source",
Description: T("Make a copy of app source code from one application to another. Unless overridden, the copy-source command will restart the application."),
Usage: T(" CF_NAME copy-source SOURCE-APP TARGET-APP [-o TARGET-ORG] [-s TARGET-SPACE] [--no-restart]\n"),
Flags: []cli.Flag{
flag_helpers.NewStringFlag("o", T("Org that contains the target application")),
flag_helpers.NewStringFlag("s", T("Space that contains the target application")),
cli.BoolFlag{Name: "no-restart", Usage: T("Override restart of the application in target environment after copy-source completes")},
},
}
}
示例8: Metadata
func (cmd *ServiceAccess) Metadata() command_metadata.CommandMetadata {
return command_metadata.CommandMetadata{
Name: "service-access",
Description: T("List service access settings"),
Usage: "CF_NAME service-access [-b BROKER] [-e SERVICE] [-o ORG]",
Flags: []cli.Flag{
flag_helpers.NewStringFlag("b", T("access for plans of a particular broker")),
flag_helpers.NewStringFlag("e", T("access for plans of a particular service offering")),
flag_helpers.NewStringFlag("o", T("plans accessible by a particular organization")),
},
}
}
示例9: Metadata
func (cmd Target) Metadata() command_metadata.CommandMetadata {
return command_metadata.CommandMetadata{
Name: "target",
ShortName: "t",
Description: T("Set or view the targeted org or space"),
Usage: T("CF_NAME target [-o ORG] [-s SPACE]"),
Flags: []cli.Flag{
flag_helpers.NewStringFlag("o", T("organization")),
flag_helpers.NewStringFlag("s", T("space")),
},
}
}
示例10: Metadata
func (cmd *Scale) Metadata() command_metadata.CommandMetadata {
return command_metadata.CommandMetadata{
Name: "scale",
Description: "Change or view the instance count, disk space limit, and memory limit for an app",
Usage: "CF_NAME scale APP [-i INSTANCES] [-k DISK] [-m MEMORY] [-f]",
Flags: []cli.Flag{
flag_helpers.NewIntFlag("i", "Number of instances"),
flag_helpers.NewStringFlag("k", "Disk limit (e.g. 256M, 1024M, 1G)"),
flag_helpers.NewStringFlag("m", "Memory limit (e.g. 256M, 1024M, 1G)"),
cli.BoolFlag{Name: "f", Usage: "Force restart of app without prompt"},
},
}
}
示例11: Metadata
func (cmd CreateQuota) Metadata() command_metadata.CommandMetadata {
return command_metadata.CommandMetadata{
Name: "create-quota",
Description: T("Define a new resource quota"),
Usage: T("CF_NAME create-quota QUOTA [-m TOTAL_MEMORY] [-i INSTANCE_MEMORY] [-r ROUTES] [-s SERVICE_INSTANCES] [--allow-paid-service-plans]"),
Flags: []cli.Flag{
flag_helpers.NewStringFlag("i", T("Maximum amount of memory an application instance can have (e.g. 1024M, 1G, 10G)")),
flag_helpers.NewStringFlag("m", T("Total amount of memory (e.g. 1024M, 1G, 10G)")),
flag_helpers.NewIntFlag("r", T("Total number of routes")),
flag_helpers.NewIntFlag("s", T("Total number of service instances")),
cli.BoolFlag{Name: "allow-paid-service-plans", Usage: T("Can provision instances of paid service plans")},
},
}
}
示例12: Metadata
func (cmd *Curl) Metadata() command_metadata.CommandMetadata {
return command_metadata.CommandMetadata{
Name: "curl",
Description: T("Executes a raw request, content-type set to application/json by default"),
Usage: T("CF_NAME curl PATH [-iv] [-X METHOD] [-H HEADER] [-d DATA] [--output FILE]"),
Flags: []cli.Flag{
cli.BoolFlag{Name: "i", Usage: T("Include response headers in the output")},
cli.BoolFlag{Name: "v", Usage: T("Enable CF_TRACE output for all requests and responses")},
cli.StringFlag{Name: "X", Value: "GET", Usage: T("HTTP method (GET,POST,PUT,DELETE,etc)")},
flag_helpers.NewStringSliceFlag("H", T("Custom headers to include in the request, flag can be specified multiple times")),
flag_helpers.NewStringFlag("d", T("HTTP data to include in the request body")),
flag_helpers.NewStringFlag("output", T("Write curl body to FILE instead of stdout")),
},
}
}
示例13: Metadata
func (cmd *UpdateUserProvidedService) Metadata() command_metadata.CommandMetadata {
return command_metadata.CommandMetadata{
Name: "update-user-provided-service",
ShortName: "uups",
Description: "Update user-provided service instance name value pairs",
Usage: "CF_NAME update-user-provided-service SERVICE_INSTANCE [-p PARAMETERS] [-l SYSLOG-DRAIN-URL]'\n\n" +
"EXAMPLE:\n" +
" CF_NAME update-user-provided-service oracle-db-mine -p '{\"username\":\"admin\",\"password\":\"pa55woRD\"}'\n" +
" CF_NAME update-user-provided-service my-drain-service -l syslog://example.com\n",
Flags: []cli.Flag{
flag_helpers.NewStringFlag("p", "Parameters"),
flag_helpers.NewStringFlag("l", "Syslog Drain Url"),
},
}
}
示例14: Metadata
func (cmd *updateQuota) Metadata() command_metadata.CommandMetadata {
return command_metadata.CommandMetadata{
Name: "update-quota",
Description: cmd.T("Update an existing resource quota"),
Usage: cmd.T("CF_NAME update-quota QUOTA [-m MEMORY] [-n NEW_NAME] [-r ROUTES] [-s SERVICE_INSTANCES] [--allow-paid-service-plans | --disallow-paid-service-plans]"),
Flags: []cli.Flag{
flag_helpers.NewStringFlag("m", cmd.T("Total amount of memory (e.g. 1024M, 1G, 10G)")),
flag_helpers.NewStringFlag("n", cmd.T("New name")),
flag_helpers.NewIntFlag("r", cmd.T("Total number of routes")),
flag_helpers.NewIntFlag("s", cmd.T("Total number of service instances")),
cli.BoolFlag{Name: "allow-paid-service-plans", Usage: cmd.T("Can provision instances of paid service plans")},
cli.BoolFlag{Name: "disallow-paid-service-plans", Usage: cmd.T("Cannot provision instances of paid service plans")},
},
}
}
示例15: Metadata
func (cmd *UpdateUserProvidedService) Metadata() command_metadata.CommandMetadata {
return command_metadata.CommandMetadata{
Name: "update-user-provided-service",
ShortName: "uups",
Description: T("Update user-provided service instance name value pairs"),
Usage: T(`CF_NAME update-user-provided-service SERVICE_INSTANCE [-p CREDENTIALS] [-l SYSLOG-DRAIN-URL]'
EXAMPLE:
CF_NAME update-user-provided-service my-db-mine -p '{"username":"admin","password":"pa55woRD"}'
CF_NAME update-user-provided-service my-drain-service -l syslog://example.com`),
Flags: []cli.Flag{
flag_helpers.NewStringFlag("p", T("Credentials")),
flag_helpers.NewStringFlag("l", T("Syslog Drain Url")),
},
}
}