aboutsummaryrefslogtreecommitdiff
path: root/libbutl/standard-version.bash.in
blob: 20215d98ec9141e7e6861643fea619ba00ab494c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# file      : libbutl/standard-version.bash.in
# license   : MIT; see accompanying LICENSE file

if [ "$butl_standard_version" ]; then
  return 0
else
  butl_standard_version=true
fi

@import libbutl/utility@

# Check that the specified predicates are true for a standard version.
#
# Parse the standard version and exit with code 0 if all the specified
# predicates are true and code 1 otherwise. If the specified argument is not a
# valid standard version, then print the error description to stderr, unless
# --is-version option is specified, and exit with code 2. For other errors
# (usage, etc), issue diagnostics and exit with code 3.
#
# Options in the --is-[not-]<predicate> form enable the standard version
# predicate checks. The recognized predicates are:
#
#   snapshot
#   latest-snapshot
#   alpha
#   beta
#   pre-release
#   release
#   final
#   stub
#   earliest
#
# Note that specifying opposite predicates (for example, --is-beta and
# --is-not-beta) is not a usage error and results in exit code 1. See
# libbutl/standard-version.mxx for the predicates semantics.
#
# Other options:
#
# --is-version
#
#   Don't issue diagnostics if the argument is not a valid standard version.
#
function butl_standard_version () # [<options>] <standard-version>
{
  "$(butl_path)/standard-version" "$@"
}