Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Feature suggestion: stubs/auto switch #38

Open
jesjos opened this issue Mar 29, 2022 · 2 comments
Open

Feature suggestion: stubs/auto switch #38

jesjos opened this issue Mar 29, 2022 · 2 comments

Comments

@jesjos
Copy link
Contributor

jesjos commented Mar 29, 2022

New users of terve might be surprised by some things:

  1. No versions of tf/tg are present after initial setup. This is not illogical, when you think about it. But it did surprise at least one user I was helping out. Perhaps terve --bootstrap could ask some questions and install sane default versions? Or maybe it could install stub binaries that say It looks like you're trying to run tf before installing a version!
  2. After installing the first version of tg or tf, the user still has to activate that version using the switch command. Not illogical, but a gotcha. Perhaps installing a version when no previous version exists could trigger auto-switch?

Then again, it might be that you should keep the tool simple and stupid and just make the docs better.

@jpalomaki
Copy link
Member

jpalomaki commented Mar 29, 2022

Hello @jesjos,

  1. I agree that this is somewhat confusing. However, rather than baking in much code in the terve program itself, this I believe we could solve elegantly by spending some time setting up an actual installer (script, brew formula, or something else). If you think this might be a good idea, feel free to create a new issue for it.
  2. I think a switch feature is definitely useful, since very often you'd want to actually use that version right away. Switch is essentially install + select (both of which are idempotent in terve), which I believe we could solve by just creating a function or script, e.g.
function tfswitch {
  terve i tf "$1" && terve s tf "$1"
}

which could be used like so:

$ tfswitch 1.1.7
Installed terraform 1.1.7
Selected terraform 1.1.7

So yeah, I'd like to keep the tool itself as simple as possible (less code to maintain), and document it better, and extend the functionality using scripting (which is essentially limitless, if we have just the right building blocks).

@jpalomaki
Copy link
Member

@jesjos I've now updated the README with a slightly more refined example of implementing switch, let me know what you think

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants