Skip to content

Commit 12ae951

Browse files
committed
feat(cli): add -V shorthand for --variable
`--variable` is used frequently enough to deserve a shorthand. Unfortunately, `-v` is taken by verbose, so `-V` seemed to be the best available alternative.
1 parent a0f478c commit 12ae951

16 files changed

+109
-16
lines changed

cli/templatecreate.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,10 @@ func (r *RootCmd) templateCreate() *clibase.Cmd {
166166
Value: clibase.StringOf(&variablesFile),
167167
},
168168
{
169-
Flag: "variable",
170-
Description: "Specify a set of values for Terraform-managed variables.",
171-
Value: clibase.StringArrayOf(&variables),
169+
Flag: "variable",
170+
Description: "Specify a set of values for Terraform-managed variables.",
171+
Value: clibase.StringArrayOf(&variables),
172+
FlagShorthand: "V",
172173
},
173174
{
174175
Flag: "provisioner-tag",

cli/templatepush.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,10 @@ func (r *RootCmd) templatePush() *clibase.Cmd {
287287
Value: clibase.StringOf(&variablesFile),
288288
},
289289
{
290-
Flag: "variable",
291-
Description: "Specify a set of values for Terraform-managed variables.",
292-
Value: clibase.StringArrayOf(&variables),
290+
Flag: "variable",
291+
Description: "Specify a set of values for Terraform-managed variables.",
292+
Value: clibase.StringArrayOf(&variables),
293+
FlagShorthand: "V",
293294
},
294295
{
295296
Flag: "provisioner-tag",

cli/testdata/coder_templates_create_--help.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Create a template from the current directory or as specified by flag
3434
--provisioner-tag string-array
3535
Specify a set of tags to target provisioner daemons.
3636

37-
--variable string-array
37+
-V, --variable string-array
3838
Specify a set of values for Terraform-managed variables.
3939

4040
--variables-file string

cli/testdata/coder_templates_push_--help.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Push a new template version from the current directory or as specified by flag
3232
--provisioner-tag string-array
3333
Specify a set of tags to target provisioner daemons.
3434

35-
--variable string-array
35+
-V, --variable string-array
3636
Specify a set of values for Terraform-managed variables.
3737

3838
--variables-file string

docs/cli/templates_create.md

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/cli/templates_push.md

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/platforms/jfrog.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ provider "artifactory" {
6363
}
6464
```
6565

66-
When pushing the template, you can pass in the variables using the `--variable` flag:
66+
When pushing the template, you can pass in the variables using the `-V` flag:
6767

6868
```sh
69-
coder templates push --variable 'jfrog_url=https://YYY.jfrog.io' --variable 'artifactory_access_token=XXX'
69+
coder templates push -V 'jfrog_url=https://YYY.jfrog.io' -V 'artifactory_access_token=XXX'
7070
```
7171

7272
## Installing jf

examples/templates/envbox/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ Coder. Consult the [migration](https://coder.com/docs/v2/latest/templates/parame
3535
documentation for details on how to do so.
3636

3737
To supply values to existing existing Terraform variables you can specify the
38-
`--variable` flag. For example
38+
`-V` flag. For example
3939

4040
```bash
41-
coder templates create envbox --variable namespace="mynamespace" --variable max_cpus=2 --variable min_cpus=1 --variable max_memory=4 --variable min_memory=1
41+
coder templates create envbox -V namespace="mynamespace" -V max_cpus=2 -V min_cpus=1 -V max_memory=4 -V min_memory=1
4242
```
4343

4444
## Contributions

examples/templates/fly-docker-image/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ This template provisions a [code-server](https://github.com/coder/code-server) i
2222

2323
```bash
2424
coder templates create fly-docker-image \
25-
--variable fly_api_token=$(flyctl auth token) \
26-
--variable fly_org=personal
25+
-V fly_api_token=$(flyctl auth token) \
26+
-V fly_org=personal
2727
```
2828

2929
> If the Coder server is also running as a fly.io app, then instead of setting variable `fly_api_token` you can also set a fly.io secret with the name `FLY_API_TOKEN`

helm/tests/testdata/command.golden

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,19 @@ rules:
4242
- patch
4343
- update
4444
- watch
45+
- apiGroups:
46+
- apps
47+
resources:
48+
- deployments
49+
verbs:
50+
- create
51+
- delete
52+
- deletecollection
53+
- get
54+
- list
55+
- patch
56+
- update
57+
- watch
4558
---
4659
# Source: coder/templates/rbac.yaml
4760
apiVersion: rbac.authorization.k8s.io/v1

helm/tests/testdata/command_args.golden

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,19 @@ rules:
4242
- patch
4343
- update
4444
- watch
45+
- apiGroups:
46+
- apps
47+
resources:
48+
- deployments
49+
verbs:
50+
- create
51+
- delete
52+
- deletecollection
53+
- get
54+
- list
55+
- patch
56+
- update
57+
- watch
4558
---
4659
# Source: coder/templates/rbac.yaml
4760
apiVersion: rbac.authorization.k8s.io/v1

helm/tests/testdata/default_values.golden

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,19 @@ rules:
4242
- patch
4343
- update
4444
- watch
45+
- apiGroups:
46+
- apps
47+
resources:
48+
- deployments
49+
verbs:
50+
- create
51+
- delete
52+
- deletecollection
53+
- get
54+
- list
55+
- patch
56+
- update
57+
- watch
4558
---
4659
# Source: coder/templates/rbac.yaml
4760
apiVersion: rbac.authorization.k8s.io/v1

helm/tests/testdata/labels_annotations.golden

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,19 @@ rules:
4242
- patch
4343
- update
4444
- watch
45+
- apiGroups:
46+
- apps
47+
resources:
48+
- deployments
49+
verbs:
50+
- create
51+
- delete
52+
- deletecollection
53+
- get
54+
- list
55+
- patch
56+
- update
57+
- watch
4558
---
4659
# Source: coder/templates/rbac.yaml
4760
apiVersion: rbac.authorization.k8s.io/v1

helm/tests/testdata/sa.golden

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,19 @@ rules:
4242
- patch
4343
- update
4444
- watch
45+
- apiGroups:
46+
- apps
47+
resources:
48+
- deployments
49+
verbs:
50+
- create
51+
- delete
52+
- deletecollection
53+
- get
54+
- list
55+
- patch
56+
- update
57+
- watch
4558
---
4659
# Source: coder/templates/rbac.yaml
4760
apiVersion: rbac.authorization.k8s.io/v1

helm/tests/testdata/tls.golden

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,19 @@ rules:
4242
- patch
4343
- update
4444
- watch
45+
- apiGroups:
46+
- apps
47+
resources:
48+
- deployments
49+
verbs:
50+
- create
51+
- delete
52+
- deletecollection
53+
- get
54+
- list
55+
- patch
56+
- update
57+
- watch
4558
---
4659
# Source: coder/templates/rbac.yaml
4760
apiVersion: rbac.authorization.k8s.io/v1

helm/tests/testdata/workspace_proxy.golden

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,19 @@ rules:
4242
- patch
4343
- update
4444
- watch
45+
- apiGroups:
46+
- apps
47+
resources:
48+
- deployments
49+
verbs:
50+
- create
51+
- delete
52+
- deletecollection
53+
- get
54+
- list
55+
- patch
56+
- update
57+
- watch
4558
---
4659
# Source: coder/templates/rbac.yaml
4760
apiVersion: rbac.authorization.k8s.io/v1

0 commit comments

Comments
 (0)