-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathapplication.go
More file actions
63 lines (51 loc) · 1.96 KB
/
application.go
File metadata and controls
63 lines (51 loc) · 1.96 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package cmd
import (
"github.com/spf13/cobra"
)
var (
appParamsPath = "./params.json"
appPatchQueries []string
)
func NewCmdApp() *cobra.Command {
appCmd := &cobra.Command{
Use: "application",
Aliases: []string{"app"},
Deprecated: "This has been renamed to `package`. This command will be removed in v2.",
}
appConfigureCmd := &cobra.Command{
Use: `configure <project>-<env>-<manifest>`,
Aliases: []string{"cfg"},
Deprecated: "This has been moved under `package`. This command will be removed in v2.",
Args: cobra.ExactArgs(1),
RunE: runPkgConfigure,
}
appConfigureCmd.Flags().StringVarP(&appParamsPath, "params", "p", appParamsPath, "Path to params JSON file. This file supports bash interpolation.")
appDeployCmd := &cobra.Command{
Use: `deploy <project>-<env>-<manifest>`,
Deprecated: "This has been moved under `package`. This command will be removed in v2.",
Args: cobra.ExactArgs(1),
RunE: runPkgDeploy,
}
appDeployCmd.Flags().StringP("message", "m", "", "Add a message when deploying")
appPatchCmd := &cobra.Command{
Use: `patch <project>-<env>-<manifest>`,
Deprecated: "This has been moved under `package`. This command will be removed in v2.",
Aliases: []string{"cfg"},
Args: cobra.ExactArgs(1),
RunE: runPkgPatch,
}
appPatchCmd.Flags().StringArrayVarP(&appPatchQueries, "set", "s", []string{}, "Sets a package parameter value using JQ expressions.")
// app and infra are the same, lets reuse a get command/template here.
pkgGetCmd := &cobra.Command{
Use: `get <project>-<env>-<manifest>`,
Deprecated: "This has been moved under `package`. This command will be removed in v2.",
Aliases: []string{"g"},
Args: cobra.ExactArgs(1), // Enforce exactly one argument
RunE: runPkgGet,
}
appCmd.AddCommand(appDeployCmd)
appCmd.AddCommand(appConfigureCmd)
appCmd.AddCommand(appPatchCmd)
appCmd.AddCommand(pkgGetCmd)
return appCmd
}