本文整理匯總了Golang中github.com/Scalingo/cli/appdetect.CurrentApp函數的典型用法代碼示例。如果您正苦於以下問題:Golang CurrentApp函數的具體用法?Golang CurrentApp怎麽用?Golang CurrentApp使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了CurrentApp函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: DeploymentsAutoComplete
func DeploymentsAutoComplete(c *cli.Context) error {
client := config.ScalingoClient()
currentApp := appdetect.CurrentApp(c)
deployments, err := client.DeploymentList(currentApp)
if err != nil {
return errgo.Mask(err, errgo.Any)
}
for _, deployment := range deployments {
fmt.Println(deployment.ID)
}
return nil
}
示例2:
If you need to inject additional environment variables, you can use the flag
'-e'. You can use it multiple time to define multiple variables. These
variables will override those defined in your application environment.
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")
},