minamijoyo / tfupdate

Update version constraints in your Terraform configurations
MIT License
542 stars 23 forks source link

Hide pre-releases by default in the release list command #42

Closed minamijoyo closed 3 years ago

minamijoyo commented 3 years ago

Fixes #31

The release list command now hides pre-releases by default and allows it to show by a new flag --pre-release.

[tfupdate@hide-preleases-by-default|✔]$ go run main.go release list hashicorp/terraform
0.14.6
0.14.7
0.14.8
0.14.9
0.14.10
0.14.11
0.15.0
0.15.1
0.15.2
0.15.3
[tfupdate@hide-preleases-by-default|✔]$ go run main.go release list --pre-release hashicorp/terraform
0.15.0-alpha20210127
0.15.0-alpha20210210
0.15.0-beta1
0.15.0-beta2
0.15.0-rc1
0.15.0-rc2
0.15.0
0.15.1
0.15.2
0.15.3

This was originally requested in #31, but there was an implementation concern for consistency at the time because all source types doesn't have the same API metadata. In #41, the list is now sorted in semver order and pre-releases can now be filtered in a consistent way for all source types. Since the list command is originally for debug, it is convenient to be able to switch the presence or absence of pre-releases.

There may be some opinions about whether the concept of release includes pre-release or not, but it's clear that latest must not be pre-release, and it seems convenient if the end of the list matches the latest for debug. So change it to hide pre-releases by default.

This is a breaking change, but it's a good opportunity to change the default in the next release because the order was changed by #41.