Skip to content

Commit 4c16c12

Browse files
committed
fix: Update the command help and examples for deployment
1 parent 7a93849 commit 4c16c12

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

pkg/cmd/deployment/root.go

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,16 @@ var deploymentName string
3232
var deploymentCmd = &cobra.Command{
3333
Use: "deployment",
3434
Short: "Work with a deployment",
35-
Long: `Delopy a project`,
35+
Long: `Stack deployment command set.
36+
37+
The deployment commands generally need 3 things:
38+
1. a target (either explicitly with "-t <targetname> or defined in the config)
39+
2. a deployment name (either explicitly with -n <deployment name> or use the default name of "dep")
40+
3. a stack definition, this could be a supplied by any of the following ways:
41+
- Provide a nitric.yaml configuration file, the path to which is provided either explicitly with "-s <stack dir> or in the current director.
42+
- A Glob to the functions from which the configuration is derived.
43+
`,
3644
Example: `nitric deployment apply
37-
nitric deployment apply -n prod -s ../project/ -t prod
38-
nitric deployment apply -n prod -s ../project/ -t prod "functions/*.ts"
39-
4045
nitric deployment delete
4146
nitric deployment list
4247
`,
@@ -46,6 +51,10 @@ var deploymentApplyCmd = &cobra.Command{
4651
Use: "apply [handlerGlob]",
4752
Short: "Create or Update a new application deployment",
4853
Long: `Applies a Nitric application deployment.`,
54+
Example: `nitric deployment apply
55+
nitric deployment apply -n prod-aws -s ../project/ -t prod
56+
nitric deployment apply -n prod-aws -s ../project/ -t prod "functions/*.ts"
57+
`,
4958
Run: func(cmd *cobra.Command, args []string) {
5059
t, err := target.FromOptions()
5160
cobra.CheckErr(err)
@@ -71,9 +80,13 @@ var deploymentApplyCmd = &cobra.Command{
7180
}
7281

7382
var deploymentDeleteCmd = &cobra.Command{
74-
Use: "delete [handlerGlob]",
83+
Use: "delete",
7584
Short: "Delete an application deployment",
7685
Long: `Delete a Nitric application deployment.`,
86+
Example: `nitric deployment delete
87+
nitric deployment delete -s ../project/ -t prod
88+
nitric deployment delete -n prod-aws -s ../project/ -t prod
89+
`,
7790
Run: func(cmd *cobra.Command, args []string) {
7891
t, err := target.FromOptions()
7992
cobra.CheckErr(err)
@@ -86,24 +99,21 @@ var deploymentDeleteCmd = &cobra.Command{
8699

87100
cobra.CheckErr(p.Delete(deploymentName))
88101
},
89-
Args: cobra.MinimumNArgs(0),
102+
Args: cobra.ExactArgs(0),
90103
}
91104

92105
var deploymentListCmd = &cobra.Command{
93-
Use: "list [handlerGlob]",
106+
Use: "list",
94107
Short: "list deployments for a stack",
95108
Long: `Lists Nitric application deployments for a stack.`,
109+
Example: `nitric list
110+
nitric deployment list -s ../project/ -t prod
111+
`,
96112
Run: func(cmd *cobra.Command, args []string) {
97113
t, err := target.FromOptions()
98114
cobra.CheckErr(err)
99115

100-
s, err := stack.FromOptions()
101-
if err != nil && len(args) > 0 {
102-
s, err = stack.FromGlobArgs(args)
103-
cobra.CheckErr(err)
104-
105-
s, err = codeconfig.Populate(s)
106-
}
116+
s, err := stack.FromOptionsMinimal()
107117
cobra.CheckErr(err)
108118

109119
p, err := provider.NewProvider(s, t)
@@ -114,7 +124,7 @@ var deploymentListCmd = &cobra.Command{
114124

115125
output.Print(deps)
116126
},
117-
Args: cobra.MinimumNArgs(0),
127+
Args: cobra.ExactArgs(0),
118128
}
119129

120130
func RootCommand() *cobra.Command {

0 commit comments

Comments
 (0)