#!/bin/bash
# versions - __package__ version number management
set -e
######
# Versions
version_parts() {
local version=$1
local major minor_micro
major=${version%%.*}
minor_micro=${version#*.}
echo "$major" "${minor_micro%.*}" "${minor_micro#*.}"
}
version_bump() {
has_args 2 "$@"
local version=$1
local part=$2
local -a parts
parts=( $(version_parts "$version") )
case "$part" in
micro) parts=( "${parts[0]}" "${parts[1]}" "$((${parts[2]} + 1))" ) ;;
minor) parts=( "${parts[0]}" "$((${parts[1]} + 1))" 0 ) ;;
major) parts=( "$((${parts[0]} + 1))" 0 0 ) ;;
*) error "$part: unknown version component" ;;
esac
echo "${parts[0]}.${parts[1]}.${parts[2]}"
}
Generated on Tue Jul 4 17:00:42 PDT 2017 by mcsh d14 v0.21.0.