ajout de semver_copy

ajout des fonctions psemver_*
This commit is contained in:
Jephte CLAIN 2014-01-18 11:11:05 +04:00
parent 3dc6f2f43a
commit 3b34e2c029
1 changed files with 23 additions and 0 deletions

View File

@ -112,6 +112,14 @@ function semver_setmetadata() {
fi
}
function semver_copy() {
set_var "$1" "${!6}"
set_var "$2" "${!7}"
set_var "$3" "${!8}"
array_copy "$4" "$9"
array_copy "$5" "${10}"
}
function semver_build() {
echo_ "${!1}.${!2}.${!3}"
array_isempty "$4" || rawecho_ "-$(array_join "$4" .)"
@ -122,3 +130,18 @@ function semver_build() {
function semver_setvar() {
set_var "$1" "$(semver_build "$2" "$3" "$4" "$5" "$6")"
}
################################################################################
# Les fonctions psemver_* sont comme semver_* mais les noms de variables sont
# standardisés (major, minor, pathchlevel, prelease, metadata) et l'on spécifie
# uniquement un préfixe pour les noms de variable
function psemver_parse() { semver_parse "$1" "${2}major" "${2}minor" "${2}patchlevel" "${2}prelease" "${2}metadata" "${2}valid"; }
function psemver_incmajor() { semver_incmajor "${1}major" "${1}minor" "${1}patchlevel" "${1}prelease" "${1}metadata"; }
function psemver_incminor() { semver_incminor "${1}major" "${1}minor" "${1}patchlevel" "${1}prelease" "${1}metadata"; }
function psemver_incpatchlevel() { semver_incpatchlevel "${1}major" "${1}minor" "${1}patchlevel" "${1}prelease" "${1}metadata"; }
function psemver_setprelease() { semver_setprelease "$1" "${2}major" "${2}minor" "${2}patchlevel" "${2}prelease" "${2}metadata"; }
function psemver_setmetadata() { semver_setmetadata "$1" "${2}major" "${2}minor" "${2}patchlevel" "${2}prelease" "${2}metadata"; }
function psemver_copy() { semver_copy "${1}major" "${1}minor" "${1}patchlevel" "${1}prelease" "${1}metadata" "${2}major" "${2}minor" "${2}patchlevel" "${2}prelease" "${2}metadata"; }
function psemver_build() { semver_build "${1}major" "${1}minor" "${1}patchlevel" "${1}prelease" "${1}metadata"; }
function psemver_setvar() { semver_setvar "$1" "${2}major" "${2}minor" "${2}patchlevel" "${2}prelease" "${2}metadata"; }