28 Semantic–version specifications

This module implements a parser for semantic–version string representations. The basic usage is as follows:

mbfl_default_object_declare(SEMVER_SPEC)
mbfl_default_object_declare(SEMVER_PARSER)
mbfl_default_object_declare(PARSER_INPUT)
declare -i START_INDEX=0

mbfl_semver_parser_input_make    _(PARSER_INPUT) '1.2.3-alpha.1+x86-64' $START_INDEX
mbfl_semver_parser_make_default  _(SEMVER_PARSER)
mbfl_semver_parse _(SEMVER_SPEC) _(SEMVER_PARSER) _(PARSER_INPUT)

mbfl_declare_varref(MAJOR_NUMBER)
mbfl_declare_varref(BUILD_METADATA)

mbfl_semver_spec_major_number_var   _(MAJOR_NUMBER)   _(SEMVER_PARSER)
mbfl_semver_spec_build_metadata_var _(BUILD_METADATA) _(SEMVER_PARSER)

"$MAJOR_NUMBER"         ⇒ 1
"$BUILD_METADATA"       ⇒ x86-64

This document describes version 3.0.0-devel.9 of Marcos Bash Functions Library.