Skip to content

Commit ddbb651

Browse files
committed
feat(cli): add --var shorthand for --variable
`--variable` is used frequently enough to deserve a shorthand. Unfortunately, `-v` is taken by verbose, and `-V` is too easily confused with version or verbose, so we're left with "--var".
1 parent de1a7a9 commit ddbb651

File tree

9 files changed

+38
-6
lines changed

9 files changed

+38
-6
lines changed

cli/templatecreate.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,11 @@ func (r *RootCmd) templateCreate() *clibase.Cmd {
170170
Description: "Specify a set of values for Terraform-managed variables.",
171171
Value: clibase.StringArrayOf(&variables),
172172
},
173+
{
174+
Flag: "var",
175+
Description: "Alias of --variable.",
176+
Value: clibase.StringArrayOf(&variables),
177+
},
173178
{
174179
Flag: "provisioner-tag",
175180
Description: "Specify a set of tags to target provisioner daemons.",

cli/templatepush.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,11 @@ func (r *RootCmd) templatePush() *clibase.Cmd {
291291
Description: "Specify a set of values for Terraform-managed variables.",
292292
Value: clibase.StringArrayOf(&variables),
293293
},
294+
{
295+
Flag: "var",
296+
Description: "Alias of --variable.",
297+
Value: clibase.StringArrayOf(&variables),
298+
},
294299
{
295300
Flag: "provisioner-tag",
296301
Description: "Specify a set of tags to target provisioner daemons.",

cli/testdata/coder_templates_create_--help.golden

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ 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+
--var string-array
38+
Alias of --variable.
39+
3740
--variable string-array
3841
Specify a set of values for Terraform-managed variables.
3942

cli/testdata/coder_templates_push_--help.golden

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ 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+
--var string-array
36+
Alias of --variable.
37+
3538
--variable string-array
3639
Specify a set of values for Terraform-managed variables.
3740

docs/cli/templates_create.md

Lines changed: 8 additions & 0 deletions
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: 8 additions & 0 deletions
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
@@ -62,10 +62,10 @@ provider "artifactory" {
6262
}
6363
```
6464

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

6767
```sh
68-
coder templates push --variable 'jfrog_url=https://YYY.jfrog.io' --variable 'artifactory_access_token=XXX'
68+
coder templates push --var 'jfrog_url=https://YYY.jfrog.io' --var 'artifactory_access_token=XXX'
6969
```
7070

7171
## 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 --var namespace="mynamespace" --var max_cpus=2 --var min_cpus=1 --var max_memory=4 --var 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+
--var fly_api_token=$(flyctl auth token) \
26+
--var 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`

0 commit comments

Comments
 (0)