Add semver sort option for tags listing and delete with -keep #29
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Add semver sort option when listing tags as well as when using the keep flag when deleting. This ways it is possible to retain the last X versions. Used an exception for 'latest' tag.
The existing numeric sort breaks when you say you want to keep the last 5 versions:
`
1.0.1
1.0.11
1.1.0
2.0.0-alpha
2.0.0-beta
2.0.0
latest
`
As one can see, with the current numeric sort the order of 1.0.11 - 1.1.0 would be wrong wit numeric sort. In Semver it's 1.0.11 < 1.1.0. When using numeric sort it's 1.0.11 > 1.1.0 (wrong).
Hence I added an option for sorting -sort (default | semver)
Related Issue
#5
Changes proposed
Simply adding a good semver lib and an additional command line flag for tags listing and delete when using the keep option. Also updated the README.md.
Screenshots
No screenshots, the description and the listing of the versions should be sufficient to explain the problem and its solution.