fmahnke / shell-semver Goto Github PK
View Code? Open in Web Editor NEWIncrement semantic versioning strings in Bash shell scripts.
License: MIT License
Increment semantic versioning strings in Bash shell scripts.
License: MIT License
An example will illustrate:
$ ./increment_version.sh -m 0.0.2 # Expected => 0.1.0
0.1.2 # <= Actual
The semver spec says:
Patch version MUST be reset to 0 when minor version is incremented.
Patch and minor version MUST be reset to 0 when major version is incremented.
This obviously has implications for the logic in the script. For example, if I request a bump of all three levels:
$ ./increment_version.sh -Mmp 1.2.3 # Expected => 2.1.1 (!?)
I doubt this is what anyone would want. Perhaps the options should be downward exclusive? So maybe if I request a M
ajor version bump, the m
and p
options get ignored? I honestly don't know, but the current behavior is definitely incorrect.
Here's a proposed change:
if [ ! -z $major ]
then
((a[0]++))
a[1]=0 # <= added
a[2]=0 # <= added
fi
if [ ! -z $minor ]
then
((a[1]++))
a[2]=0 # <= added
fi
if [ ! -z $patch ]
then
((a[2]++))
fi
Thanks.
Helped me a lot!
Thank YOU!
When making release, I need to know in some scenarios previous version.
Please add -i
(or similar) option support for inverse direction
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.