本文整理汇总了Golang中github.com/Scalingo/cli/cmd/autocomplete.CmdFlagsAutoComplete函数的典型用法代码示例。如果您正苦于以下问题:Golang CmdFlagsAutoComplete函数的具体用法?Golang CmdFlagsAutoComplete怎么用?Golang CmdFlagsAutoComplete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CmdFlagsAutoComplete函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
package cmd
import (
"github.com/Scalingo/cli/Godeps/_workspace/src/github.com/Scalingo/codegangsta-cli"
"github.com/Scalingo/cli/apps"
"github.com/Scalingo/cli/cmd/autocomplete"
)
var (
AppsCommand = cli.Command{
Name: "apps",
Category: "Global",
Description: "List your apps and give some details about them",
Usage: "List your apps",
Action: func(c *cli.Context) {
if err := apps.List(); err != nil {
errorQuit(err)
}
},
BashComplete: func(c *cli.Context) {
autocomplete.CmdFlagsAutoComplete(c, "apps")
},
}
)
示例2:
Action: func(c *cli.Context) {
currentApp := appdetect.CurrentApp(c)
var err error
if len(c.Args()) == 0 {
err = domains.List(currentApp)
} else {
cli.ShowCommandHelp(c, "domains")
}
if err != nil {
errorQuit(err)
}
},
BashComplete: func(c *cli.Context) {
autocomplete.CmdFlagsAutoComplete(c, "domains")
},
}
DomainsAddCommand = cli.Command{
Name: "domains-add",
Category: "Custom Domains",
Usage: "Add a custom domain to an application",
Flags: []cli.Flag{appFlag,
cli.StringFlag{Name: "cert", Usage: "SSL Signed Certificate", Value: "domain.crt", EnvVar: ""},
cli.StringFlag{Name: "key", Usage: "SSL Keypair", Value: "domain.key", EnvVar: ""},
},
Description: `Add a custom domain to an application:
$ scalingo -a myapp domains-add example.com
示例3:
"github.com/Scalingo/cli/cmd/autocomplete"
"github.com/Scalingo/codegangsta-cli"
)
var (
RestartCommand = cli.Command{
Name: "restart",
Category: "App Management",
Usage: "Restart processes of your app",
Flags: []cli.Flag{appFlag, cli.BoolFlag{Name: "synchronous, s", Usage: "Do the restart synchronously", EnvVar: ""}},
Description: `Restart one or several process or your application:
Example
## Restart all the processes
scalingo --app my-app restart
## Restart all the web processes
scalingo --app my-app restart web
## Restart a specific container
scalingo --app my-app restart web-1`,
Action: func(c *cli.Context) {
currentApp := appdetect.CurrentApp(c)
if err := apps.Restart(currentApp, c.Bool("s"), c.Args()); err != nil {
errorQuit(err)
}
},
BashComplete: func(c *cli.Context) {
autocomplete.CmdFlagsAutoComplete(c, "restart")
autocomplete.RestartAutoComplete(c)
},
}
)
示例4:
package cmd
import (
"github.com/Scalingo/cli/Godeps/_workspace/src/github.com/Scalingo/codegangsta-cli"
"github.com/Scalingo/cli/cmd/autocomplete"
)
var (
HelpCommand = cli.Command{
Name: "help",
Usage: "Shows a list of commands or help for one command",
Action: func(c *cli.Context) {
args := c.Args()
if args.Present() {
cli.ShowCommandHelp(c, args.First())
} else {
cli.ShowAppHelp(c)
}
},
BashComplete: func(c *cli.Context) {
autocomplete.CmdFlagsAutoComplete(c, "help")
autocomplete.HelpAutoComplete(c)
},
}
)
示例5:
"github.com/Scalingo/cli/Godeps/_workspace/src/github.com/Scalingo/codegangsta-cli"
"github.com/Scalingo/cli/appdetect"
"github.com/Scalingo/cli/cmd/autocomplete"
"github.com/Scalingo/cli/db"
)
var (
MySQLConsoleCommand = cli.Command{
Name: "mysql-console",
Category: "Databases",
Usage: "Run an interactive console with your MySQL addon",
Flags: []cli.Flag{appFlag},
Description: ` Run an interactive console with your MySQL addon.
$ scalingo -a myapp mysql-console
# See also 'mongo-console' and 'pgsql-console'
`,
Action: func(c *cli.Context) {
currentApp := appdetect.CurrentApp(c)
if len(c.Args()) != 0 {
cli.ShowCommandHelp(c, "redis-console")
} else if err := db.MySQLConsole(currentApp); err != nil {
errorQuit(err)
}
},
BashComplete: func(c *cli.Context) {
autocomplete.CmdFlagsAutoComplete(c, "mysql-console")
},
}
)
示例6:
`,
Action: func(c *cli.Context) {
currentApp := appdetect.CurrentApp(c)
var err error
if len(c.Args()) == 0 {
err = notifications.List(currentApp)
} else {
cli.ShowCommandHelp(c, "notifications")
}
if err != nil {
errorQuit(err)
}
},
BashComplete: func(c *cli.Context) {
autocomplete.CmdFlagsAutoComplete(c, "notifications")
},
}
NotificationsAddCommand = cli.Command{
Name: "notifications-add",
Category: "Notifications",
Flags: []cli.Flag{appFlag},
Usage: "Enable a notification for your application",
Description: ` Enable a notification for your application:
$ scalingo -a myapp notifications-add <webhook-url>
# See also 'notifications' and 'notifications-remove'
`,
Action: func(c *cli.Context) {
currentApp := appdetect.CurrentApp(c)
var err error
示例7:
Example
scalingo run -e VARIABLE=VALUE -e VARIABLE2=OTHER_VALUE rails console
Furthermore, you may want to upload a file, like a database dump or anything
useful to you. The option '-f' has been built for this purpose, you can even
upload multiple files if you wish. You will be able to find these files in the
'/tmp/uploads' directory of the one-off container.
Example
scalingo run -f mysqldump.sql rails dbconsole < /tmp/uploads/mysqldump.sql`,
Action: func(c *cli.Context) {
currentApp := appdetect.CurrentApp(c)
opts := apps.RunOpts{
App: currentApp,
Cmd: c.Args(),
CmdEnv: c.StringSlice("e"),
Files: c.StringSlice("f"),
}
if len(c.Args()) == 0 {
cli.ShowCommandHelp(c, "run")
} else if err := apps.Run(opts); err != nil {
errorQuit(err)
}
},
BashComplete: func(c *cli.Context) {
autocomplete.CmdFlagsAutoComplete(c, "run")
},
}
)
示例8:
Action: func(c *cli.Context) {
currentApp := appdetect.CurrentApp(c)
var err error
if len(c.Args()) == 0 {
err = env.Display(currentApp)
} else {
cli.ShowCommandHelp(c, "env")
}
if err != nil {
errorQuit(err)
}
},
BashComplete: func(c *cli.Context) {
autocomplete.CmdFlagsAutoComplete(c, "env")
},
}
EnvSetCommand = cli.Command{
Name: "env-set",
Category: "Environment",
Flags: []cli.Flag{appFlag},
Usage: "Set the environment variables of your apps",
Description: `Set variables:
$ scalingo -a myapp env-set VAR1=VAL1 VAR2=VAL2
# See also commands 'env' and 'env-unset'`,
Action: func(c *cli.Context) {
示例9:
Usage: "List the collaborators of an application",
Flags: []cli.Flag{appFlag},
Description: "List all the collaborator of an application and display information about them.",
Action: func(c *cli.Context) {
currentApp := appdetect.CurrentApp(c)
if len(c.Args()) != 0 {
cli.ShowCommandHelp(c, "collaborators")
} else {
err := collaborators.List(currentApp)
if err != nil {
errorQuit(err)
}
}
},
BashComplete: func(c *cli.Context) {
autocomplete.CmdFlagsAutoComplete(c, "collaborators")
},
}
CollaboratorsAddCommand = cli.Command{
Name: "collaborators-add",
Category: "Collaborators",
Usage: "Invite someone to work on an application",
Flags: []cli.Flag{appFlag},
Description: "Invite someone to collaborate on an application, an invitation will be sent to the given email\n scalingo -a myapp collaborators-add [email protected]",
Action: func(c *cli.Context) {
currentApp := appdetect.CurrentApp(c)
if len(c.Args()) != 1 {
cli.ShowCommandHelp(c, "collaborators-add")
} else {
err := collaborators.Add(currentApp, c.Args()[0])
示例10:
"github.com/Scalingo/cli/appdetect"
"github.com/Scalingo/cli/cmd/autocomplete"
"github.com/Scalingo/cli/db"
"github.com/Scalingo/codegangsta-cli"
)
var (
RedisConsoleCommand = cli.Command{
Name: "redis-console",
Category: "Databases",
Usage: "Run an interactive console with your redis addon",
Flags: []cli.Flag{appFlag},
Description: ` Run an interactive console with your redis addon.
$ scalingo -a myapp redis-console
# See also 'mongo-console' and 'mysql-console'
`,
Action: func(c *cli.Context) {
currentApp := appdetect.CurrentApp(c)
if len(c.Args()) != 0 {
cli.ShowCommandHelp(c, "redis-console")
} else if err := db.RedisConsole(currentApp); err != nil {
errorQuit(err)
}
},
BashComplete: func(c *cli.Context) {
autocomplete.CmdFlagsAutoComplete(c, "redis-console")
},
}
)
示例11:
package cmd
import (
"github.com/Scalingo/cli/addon_providers"
"github.com/Scalingo/cli/cmd/autocomplete"
"github.com/Scalingo/codegangsta-cli"
)
var (
AddonProvidersListCommand = cli.Command{
Name: "addons-list",
Category: "Addons - Global",
Description: "List all addons you can add to your app.",
Usage: "List all addons",
Action: func(c *cli.Context) {
if err := addon_providers.List(); err != nil {
errorQuit(err)
}
},
BashComplete: func(c *cli.Context) {
autocomplete.CmdFlagsAutoComplete(c, "addons-list")
},
}
)
示例12:
"github.com/Scalingo/cli/appdetect"
"github.com/Scalingo/cli/apps"
"github.com/Scalingo/cli/cmd/autocomplete"
)
var (
ScaleCommand = cli.Command{
Name: "scale",
Category: "App Management",
Flags: []cli.Flag{appFlag, cli.BoolFlag{Name: "synchronous", Usage: "Do the scaling synchronously", EnvVar: ""}},
Usage: "Scale your application instantly",
Description: `Scale your application processes.
Example
'scalingo --app my-app scale web:2 worker:1'
'scalingo --app my-app scale web:1 worker:0'
'scalingo --app my-app scale web:1:XL'`,
Action: func(c *cli.Context) {
currentApp := appdetect.CurrentApp(c)
if len(c.Args()) == 0 {
cli.ShowCommandHelp(c, "scale")
} else if err := apps.Scale(currentApp, c.Bool("synchronous"), c.Args()); err != nil {
errorQuit(err)
}
},
BashComplete: func(c *cli.Context) {
autocomplete.CmdFlagsAutoComplete(c, "scale")
autocomplete.ScaleAutoComplete(c)
},
}
)
示例13:
"github.com/Scalingo/cli/Godeps/_workspace/src/github.com/Scalingo/codegangsta-cli"
"github.com/Scalingo/cli/appdetect"
"github.com/Scalingo/cli/cmd/autocomplete"
"github.com/Scalingo/cli/db"
)
var (
MongoConsoleCommand = cli.Command{
Name: "mongo-console",
Category: "Databases",
Usage: "Run an interactive console with your MongoDB addon",
Flags: []cli.Flag{appFlag},
Description: ` Run an interactive console with your MongoDB addon.
$ scalingo -a myapp mongo-console
# See also 'redis-console' and 'mysql-console'
`,
Action: func(c *cli.Context) {
currentApp := appdetect.CurrentApp(c)
if len(c.Args()) != 0 {
cli.ShowCommandHelp(c, "mongo-console")
} else if err := db.MongoConsole(currentApp); err != nil {
errorQuit(err)
}
},
BashComplete: func(c *cli.Context) {
autocomplete.CmdFlagsAutoComplete(c, "mongo-console")
},
}
)
示例14:
import (
"github.com/Scalingo/cli/Godeps/_workspace/src/github.com/Scalingo/codegangsta-cli"
"github.com/Scalingo/cli/apps"
"github.com/Scalingo/cli/cmd/autocomplete"
)
var (
CreateCommand = cli.Command{
Name: "create",
ShortName: "c",
Category: "Global",
Description: "Create a new app:\n Example:\n 'scalingo create mynewapp'\n 'scalingo create mynewapp --remote \"staging\"'",
Flags: []cli.Flag{cli.StringFlag{Name: "remote", Value: "scalingo", Usage: "Remote to add to your current git repository", EnvVar: ""}},
Usage: "Create a new app",
Action: func(c *cli.Context) {
if len(c.Args()) != 1 {
cli.ShowCommandHelp(c, "create")
} else {
err := apps.Create(c.Args()[0], c.String("remote"))
if err != nil {
errorQuit(err)
}
}
},
BashComplete: func(c *cli.Context) {
autocomplete.CmdFlagsAutoComplete(c, "create")
},
}
)
示例15:
Category: "Public SSH Keys",
Usage: "List your SSH public keys",
Description: `List all the public SSH keys associated with your account:
$ scalingo keys
# See also commands 'keys-add' and 'keys-remove'`,
Action: func(c *cli.Context) {
err := keys.List()
if err != nil {
errorQuit(err)
}
},
BashComplete: func(c *cli.Context) {
autocomplete.CmdFlagsAutoComplete(c, "keys")
},
}
AddSSHKeyCommand = cli.Command{
Name: "keys-add",
Category: "Public SSH Keys",
Usage: "Add a public SSH key to deploy your apps",
Description: `Add a public SSH key:
$ scalingo keys-add keyname /path/to/key
# See also commands 'keys' and 'keys-remove'`,
Action: func(c *cli.Context) {
if len(c.Args()) != 2 {