Skip to content

feat(cli): add --create flag to templates push #8454

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Flag: create
  • Loading branch information
mtojek committed Jul 12, 2023
commit d05f3311ce12a681d6fbf485202336c80dee9fda
7 changes: 7 additions & 0 deletions cli/templatepush.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ func (r *RootCmd) templatePush() *clibase.Cmd {
provisionerTags []string
uploadFlags templateUploadFlags
activate bool
create bool
)
client := new(codersdk.Client)
cmd := &clibase.Cmd{
Expand Down Expand Up @@ -290,6 +291,12 @@ func (r *RootCmd) templatePush() *clibase.Cmd {
Default: "true",
Value: clibase.BoolOf(&activate),
},
{
Flag: "create",
Description: "Create the template if it does not exist.",
Default: "false",
Value: clibase.BoolOf(&create),
},
cliui.SkipPromptOption(),
}
cmd.Options = append(cmd.Options, uploadFlags.options()...)
Expand Down
3 changes: 3 additions & 0 deletions cli/testdata/coder_templates_push_--help.golden
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ Push a new template version from the current directory or as specified by flag
Always prompt all parameters. Does not pull parameter values from
active template version.

--create bool (default: false)
Create the template if it does not exist.

-d, --directory string (default: .)
Specify the directory to create from, use '-' to read tar from stdin.

Expand Down
9 changes: 9 additions & 0 deletions docs/cli/templates_push.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ Whether the new template will be marked active.

Always prompt all parameters. Does not pull parameter values from active template version.

### --create

| | |
| ------- | ------------------ |
| Type | <code>bool</code> |
| Default | <code>false</code> |

Create the template if it does not exist.

### -d, --directory

| | |
Expand Down