autoriser --allow-emptyp pour l'action --show

This commit is contained in:
Jephté Clain 2015-03-23 14:39:10 +04:00
parent f90ad4d061
commit 9389fb01e8
1 changed files with 15 additions and 5 deletions

View File

@ -134,6 +134,7 @@ function pver() {
local file=
local git=
local version=
local allow_empty=
local convert=auto
local operator=
local oversion=
@ -154,6 +155,7 @@ function pver() {
-g:,--git-string: '$set@ git; source=git-string' \
-s:,--string: '$set@ version; source=string' \
--show action=show \
--allow-empty allow_empty=1 \
--check action=check \
--convert convert=1 \
--no-convert convert= \
@ -230,7 +232,8 @@ function pver() {
version="$(git cat-file blob "$branch:$name" 2>/dev/null)"
fi
fi
[ -n "$version" ] || version=0.0.0
[ "$action" == show ] || allow_empty=
[ -n "$version" -o -n "$allow_empty" ] || version=0.0.0
# Conversion éventuelle du numéro de version
psemver_parse "$version"
@ -306,12 +309,19 @@ BEGIN {
# Actions
if [ "$action" == show ]; then
if [ -n "$version" ]; then
if isatty; then
estepi "La version actuelle est $version"
else
echo "$version"
fi
return 0
else
if isatty; then
estepi "Il n'y a pas de version définie"
fi
return 1
fi
fi
if [ "$action" == check ]; then