/
mongo.go
47 lines (42 loc) · 1.32 KB
/
mongo.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package cmd
import (
"github.com/Scalingo/cli/appdetect"
"github.com/Scalingo/cli/cmd/autocomplete"
"github.com/Scalingo/cli/db"
"github.com/urfave/cli"
)
var (
MongoConsoleCommand = cli.Command{
Name: "mongo-console",
Category: "Databases",
Usage: "Run an interactive console with your MongoDB addon",
Flags: []cli.Flag{appFlag,
cli.StringFlag{Name: "size, s", Value: "", Usage: "Size of the container"},
},
Description: ` Run an interactive console with your MongoDB addon.
Examples
scalingo --app myapp mongo-console
scalingo --app myapp mongo-console --size L
The --size flag makes it easy to specify the size of the container executing
the MongoDB console. Each container size has different price and performance.
You can read more about container sizes here:
http://doc.scalingo.com/internals/container-sizes.html
# See also 'redis-console' and 'mysql-console'
`,
Action: func(c *cli.Context) {
currentApp := appdetect.CurrentApp(c)
opts := db.MongoConsoleOpts{
App: currentApp,
Size: c.String("s"),
}
if len(c.Args()) != 0 {
cli.ShowCommandHelp(c, "mongo-console")
} else if err := db.MongoConsole(opts); err != nil {
errorQuit(err)
}
},
BashComplete: func(c *cli.Context) {
autocomplete.CmdFlagsAutoComplete(c, "mongo-console")
},
}
)