The semantic versioner for Bourne Shell.
semver.sh [-r <rule>] [<version>... ]
Given a rule and one or many versions, it will return all of the provided versions that satisfy the rule, in sorted order, one per line.
If versions are omitted from the command line, it will read them from STDIN.
If the rule is omitted from the command line, it will simply sort all the provided versions.
Every version range contains one or more sets of comparators. To satisfy version range version must satisfies all comparators from at least one set. Sets are separated with two vertical bars
||. Rules in each set are separated with whitespaces. Empty set are treated as wildcard comparator
There are five basic comparators:
- Equal to
=operator is optional, it may be provided but usually it isn't).
- Less than
- Greater than
- Less than or equal to
- Greater than or equal to
Wildcard comparators can be satisfied by any version, even prerelease one.
* character can be used
Wildcard ranges can be satisfied when only part of version is matching. In contrast to wildcards, wildcard ranges cannot be satisfied by prerelease versions.
A.*.*is satisfied when majors are the same,
A.B.*is satisfied when majors and minors are the same.
The special character (
X) is optional.
Matches to compatible versions.
If patch version is specified tilde ranges matches to all greater or equal versions with the same minor version. Otherwise is equivalent of
A.B.* when minor version is specified or
A.*.* when not.
A.B.C - X.Y.Z
A.B.C - X.Y.Z equivalent of
Prerelease versions can satisfy comparators set only when have the same minor major and patch numbers as at least one of comparators.