Skip to content

feat: add template checkout command to extract a template to an expanded local directory instead of a tar #2867

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

Closed
wants to merge 12 commits into from

Conversation

ketang
Copy link
Contributor

@ketang ketang commented Jul 8, 2022

fixes #2651

@ketang ketang requested a review from kylecarbs July 8, 2022 20:10
@ketang ketang changed the title Ketang/template export command add template checkout command to extract a template to an expanded local directory instead of a tar Jul 8, 2022

func templateCheckout() *cobra.Command {
cmd := &cobra.Command{
Use: "checkout <template name> [destination]",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the rationale to make this a separate command from pull? I feel as though it does essentially the same thing, but --extract may be clearer to a caller.

I'm concerned of the checkout name, because of the association with git.

I'd propose a UX like:

$ coder templates pull <name>
Warning: Binary output can mess up your terminal. Use "--extract -" to tell
Warning: coder to output it to your terminal anyway, or consider "--extract
Warning: <FOLDER>" to extract to a directory.

This output is taken verbatim from curl.

Copy link
Contributor Author

@ketang ketang Jul 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, one reason to make it a separate command is because I think the more common thing will be to download into an unpacked tree, so I don't want people to always have to type --extract. I'm open to different names, but I chose checkout precisely because of the similarity with version control systems.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checkout gives the appearance that it's checking out a ref if you're familiar with Git. I don't think it'd be synonymous with cloning a repository, which this does.

I think extract is better, but having two commands I think is excessively verbose for what this does. It's not a big deal to type --extract, and I'm fine to swap the default behavior to extract to a directory too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. I'll swap the behaviors and add a --archive flag.

@ketang ketang changed the title add template checkout command to extract a template to an expanded local directory instead of a tar feat: add template checkout command to extract a template to an expanded local directory instead of a tar Jul 11, 2022
@github-actions github-actions bot added stale This issue is like stale bread. and removed stale This issue is like stale bread. labels Jul 23, 2022
@github-actions
Copy link

This Pull Request is becoming stale. In order to minimize WIP, prevent merge conflicts and keep the tracker readable, I'm going close to this PR in 3 days if there isn't more activity.

@github-actions github-actions bot added the stale This issue is like stale bread. label Jul 31, 2022
@ketang
Copy link
Contributor Author

ketang commented Jul 31, 2022

I need to revisit this.

@github-actions github-actions bot removed the stale This issue is like stale bread. label Aug 1, 2022
@github-actions
Copy link

github-actions bot commented Aug 9, 2022

This Pull Request is becoming stale. In order to minimize WIP, prevent merge conflicts and keep the tracker readable, I'm going close to this PR in 3 days if there isn't more activity.

@github-actions github-actions bot added the stale This issue is like stale bread. label Aug 9, 2022
@github-actions github-actions bot closed this Aug 13, 2022
@github-actions github-actions bot deleted the ketang/template-export-command branch February 4, 2023 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale This issue is like stale bread.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

coder template pull <name> does not pull as a folder
2 participants