Skip to content
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

tfinstall cmd #29

Merged
merged 1 commit into from
Sep 3, 2020
Merged

tfinstall cmd #29

merged 1 commit into from
Sep 3, 2020

Conversation

kmoe
Copy link
Member

@kmoe kmoe commented Jul 13, 2020

closes #15

First pass at a tfinstall binary. Current usage:

Usage: tfinstall [--dir=DIR] VERSION

  Downloads, verifies, and installs a terraform binary of version
  VERSION from releases.hashicorp.com. VERSION must be a valid version under
  semantic versioning, or "latest".

  If a binary is successfully installed, its path will be printed to stdout.

  Unless --dir is given, the default system temporary directory will be used.

Options:
  --dir          Directory into which to install the terraform binary. The
                 directory must exist.

Examples:
  tfinstall 0.12.28
  tfinstall latest
  tfinstall 0.13.0-beta3
  tfinstall --dir=/home/kmoe/bin 0.12.28

@paultyng @radeksimko looking for feedback on the UX here. This is intended as a simple utility for use in CI build steps. When we're happy with it I can add config to build and release binaries as part of the release process.

Implemented using a somewhat bastardised version of mitchellh/cli, because I wanted cli.Ui but there's currently no way to have flags without subcommands (mitchellh/cli#24).

@paultyng
Copy link
Contributor

The UX looks good to me, the only thing I would probably prefer would that no args/flags at all (ie. just tfinstall) is equivalent to tfinstall latest.

Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

the only thing I would probably prefer would that no args/flags at all (ie. just tfinstall) is equivalent to tfinstall latest.

I would disagree here. There's a number of Unix-based tools which bring up help page when executed without arguments, I think that is a safe default.

The use cases we are IMO mostly targetting with this is CI, where you set it up once and forget about it - so you'd usually take care to study supported flags anyway before making it run on every PR and explicitness is what you'd prefer there too.

Lastly I think that installing latest is probably a bad idea in most cases where there is an existing config, so we shouldn't be encouraging it.

cmd/tfinstall/main.go Outdated Show resolved Hide resolved
@kmoe kmoe force-pushed the cli-utility branch 2 times, most recently from b6c1bd2 to 533a470 Compare September 3, 2020 16:40
@kmoe kmoe marked this pull request as ready for review September 3, 2020 16:41
@kmoe
Copy link
Member Author

kmoe commented Sep 3, 2020

@paultyng this is ready to merge now in preparation for future work. I'll add the goreleaser config (#71) in a separate PR.

@paultyng
Copy link
Contributor

paultyng commented Sep 3, 2020

Just rebased and go mod tidy on this in my update.

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

Successfully merging this pull request may close these issues.

tfinstall CLI utility
3 participants