autoriser --allow-emptyp pour l'action --show
This commit is contained in:
parent
f90ad4d061
commit
9389fb01e8
|
@ -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 isatty; then
|
||||
estepi "La version actuelle est $version"
|
||||
if [ -n "$version" ]; then
|
||||
if isatty; then
|
||||
estepi "La version actuelle est $version"
|
||||
else
|
||||
echo "$version"
|
||||
fi
|
||||
return 0
|
||||
else
|
||||
echo "$version"
|
||||
if isatty; then
|
||||
estepi "Il n'y a pas de version définie"
|
||||
fi
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "$action" == check ]; then
|
||||
|
|
Loading…
Reference in New Issue