-
Notifications
You must be signed in to change notification settings - Fork 91
/
Copy pathinfo.go
47 lines (38 loc) · 1.09 KB
/
info.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 commands
import (
"fmt"
"github.com/spf13/cobra"
"github.com/nanobox-io/nanobox/helpers"
"github.com/nanobox-io/nanobox/models"
"github.com/nanobox-io/nanobox/processors/app"
"github.com/nanobox-io/nanobox/util/config"
"github.com/nanobox-io/nanobox/util/display"
)
var (
// InfoCmd ...
InfoCmd = &cobra.Command{
Use: "info [local | dry-run]",
Short: "Show information about the specified environment.",
Long: `
Shows information about the specified environment. You must
specify which environment you would like information about.
`,
Run: infoFn,
}
)
// infoFn ...
func infoFn(ccmd *cobra.Command, args []string) {
env, _ := models.FindEnvByID(config.EnvID())
args, location, name := helpers.Endpoint(env, args, 0)
switch location {
case "local":
appModel, _ := models.FindAppBySlug(config.EnvID(), name)
display.CommandErr(app.Info(env, appModel))
case "production":
fmt.Printf(`
----------------------------------------------------------
Showing production app information is not yet implemneted.
----------------------------------------------------------
`)
}
}