runs: ajout des options --force, --copy-links et --with-vcs à ref()
This commit is contained in:
parent
91686fb86f
commit
1ca0ee54b5
|
@ -1300,10 +1300,17 @@ function runs_action_desc() {
|
||||||
function ref() {
|
function ref() {
|
||||||
local -a __args
|
local -a __args
|
||||||
parse_opts + \
|
parse_opts + \
|
||||||
|
-r,--required,-m,--mandatory '$:' \
|
||||||
|
-f,--required-file '$:' \
|
||||||
|
-d,--required-dir '$:' \
|
||||||
-s:,--sconf: '$:' \
|
-s:,--sconf: '$:' \
|
||||||
|
--rs,--rsconf,--required-sconf '$:' \
|
||||||
-V:,--refvar: '$:' \
|
-V:,--refvar: '$:' \
|
||||||
-v:,--vars: '$:' \
|
-v:,--vars: '$:' \
|
||||||
-l:,--lconf: '$:' \
|
-l:,--lconf: '$:' \
|
||||||
|
--force '$:' \
|
||||||
|
--copy-links '$:' \
|
||||||
|
--with-vcs '$:' \
|
||||||
@ __args -- "$@" && set -- "${__args[@]}" || die "$__args"
|
@ __args -- "$@" && set -- "${__args[@]}" || die "$__args"
|
||||||
runs_var "$@"
|
runs_var "$@"
|
||||||
RUNSVARDESC=
|
RUNSVARDESC=
|
||||||
|
@ -1343,10 +1350,17 @@ function runs_action_dump() {
|
||||||
function ref() {
|
function ref() {
|
||||||
local -a __args
|
local -a __args
|
||||||
parse_opts + \
|
parse_opts + \
|
||||||
|
-r,--required,-m,--mandatory '$:' \
|
||||||
|
-f,--required-file '$:' \
|
||||||
|
-d,--required-dir '$:' \
|
||||||
-s:,--sconf: '$:' \
|
-s:,--sconf: '$:' \
|
||||||
|
--rs,--rsconf,--required-sconf '$:' \
|
||||||
-V:,--refvar: '$:' \
|
-V:,--refvar: '$:' \
|
||||||
-v:,--vars: '$:' \
|
-v:,--vars: '$:' \
|
||||||
-l:,--lconf: '$:' \
|
-l:,--lconf: '$:' \
|
||||||
|
--force '$:' \
|
||||||
|
--copy-links '$:' \
|
||||||
|
--with-vcs '$:' \
|
||||||
@ __args -- "$@" && set -- "${__args[@]}" || die "$__args"
|
@ __args -- "$@" && set -- "${__args[@]}" || die "$__args"
|
||||||
runs_var "$@"
|
runs_var "$@"
|
||||||
RUNSVARDESC=
|
RUNSVARDESC=
|
||||||
|
@ -1417,6 +1431,9 @@ function runs_action_run() {
|
||||||
-V:,--refvar: __refvarname= \
|
-V:,--refvar: __refvarname= \
|
||||||
-v:,--vars: '$:' \
|
-v:,--vars: '$:' \
|
||||||
-l:,--lconf: '$:' \
|
-l:,--lconf: '$:' \
|
||||||
|
--force '$:' \
|
||||||
|
--copy-links '$:' \
|
||||||
|
--with-vcs '$:' \
|
||||||
@ __args -- "$@" && set -- "${__args[@]}" || die "$__args"
|
@ __args -- "$@" && set -- "${__args[@]}" || die "$__args"
|
||||||
|
|
||||||
if [ -n "$__shellconf" ]; then
|
if [ -n "$__shellconf" ]; then
|
||||||
|
@ -1584,8 +1601,8 @@ function runs_action_export() {
|
||||||
local -a __args
|
local -a __args
|
||||||
local __ref __name __value __copy __required __rdir __rfile __rsconf
|
local __ref __name __value __copy __required __rdir __rfile __rsconf
|
||||||
local __shellconfs __shellconf __refvarname=refdir __refvar __shellvars
|
local __shellconfs __shellconf __refvarname=refdir __refvar __shellvars
|
||||||
local __lineconfs __lineconf
|
local __lineconfs __lineconf __force __copy_links __novcs=1
|
||||||
local __tmpconf __wildconf
|
local __tmpconf __wildconf __cpcmd
|
||||||
parse_opts + \
|
parse_opts + \
|
||||||
-r,--required,-m,--mandatory __required=1 \
|
-r,--required,-m,--mandatory __required=1 \
|
||||||
-f,--required-file '$__required=1; __rfile=1' \
|
-f,--required-file '$__required=1; __rfile=1' \
|
||||||
|
@ -1595,6 +1612,9 @@ function runs_action_export() {
|
||||||
-V:,--refvar: __refvarname= \
|
-V:,--refvar: __refvarname= \
|
||||||
-v:,--vars: __shellvars= \
|
-v:,--vars: __shellvars= \
|
||||||
-l:,--lconf: __lineconf= \
|
-l:,--lconf: __lineconf= \
|
||||||
|
--force __force=1 \
|
||||||
|
--copy-links __copy_links=1 \
|
||||||
|
--with-vcs __novcs= \
|
||||||
@ __args -- "$@" && set -- "${__args[@]}" || die "$__args"
|
@ __args -- "$@" && set -- "${__args[@]}" || die "$__args"
|
||||||
|
|
||||||
if [ -n "$__shellconf" ]; then
|
if [ -n "$__shellconf" ]; then
|
||||||
|
@ -1665,6 +1685,16 @@ function runs_action_export() {
|
||||||
[ -n "$__shellconf" -o -n "$__lineconf" ] && die "-f est incompatible avec -s et -l"
|
[ -n "$__shellconf" -o -n "$__lineconf" ] && die "-f est incompatible avec -s et -l"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# utiliser par défaut cpnovcs pour la copie des fichiers sauf si
|
||||||
|
# --with-vcs est utilisé
|
||||||
|
[ -n "$__novcs" ] && __cpcmd=cpnovcs || __cpcmd=cpvcs
|
||||||
|
local -a __CPNOVCS_RSYNC_ARGS
|
||||||
|
if [ -n "$__copy_links" ]; then
|
||||||
|
__CPNOVCS_RSYNC_ARGS=(--copy-links)
|
||||||
|
else
|
||||||
|
__CPNOVCS_RSYNC_ARGS=(--copy-unsafe-links)
|
||||||
|
fi
|
||||||
|
|
||||||
for __ref in "$@"; do
|
for __ref in "$@"; do
|
||||||
if [ -n "$__shellconf" -a -z "$__shellvars" ]; then
|
if [ -n "$__shellconf" -a -z "$__shellvars" ]; then
|
||||||
ewarn "L'option -v n'a pas été spécifiée pour $__ref"
|
ewarn "L'option -v n'a pas été spécifiée pour $__ref"
|
||||||
|
@ -1702,6 +1732,9 @@ function runs_action_export() {
|
||||||
RUNSVARDESC=
|
RUNSVARDESC=
|
||||||
array_add RUNSREFS "$__name"
|
array_add RUNSREFS "$__name"
|
||||||
|
|
||||||
|
# options de copie
|
||||||
|
[ -n "$__force" ] && __copy=1
|
||||||
|
|
||||||
if [ -n "$__copy" ]; then
|
if [ -n "$__copy" ]; then
|
||||||
if [ -n "$__shellconf" ]; then
|
if [ -n "$__shellconf" ]; then
|
||||||
# copier les fichiers mentionnés dans le fichier de
|
# copier les fichiers mentionnés dans le fichier de
|
||||||
|
@ -1710,7 +1743,6 @@ function runs_action_export() {
|
||||||
mkdirof "$RUNSROOTDIR$__value"
|
mkdirof "$RUNSROOTDIR$__value"
|
||||||
if [ -n "$__shellvars" ]; then
|
if [ -n "$__shellvars" ]; then
|
||||||
(
|
(
|
||||||
__CPNOVCS_RSYNC_ARGS=(--copy-unsafe-links)
|
|
||||||
array_split __shellvars "$__shellvars" ,
|
array_split __shellvars "$__shellvars" ,
|
||||||
splitwcs "$__shellconf" __tmpconf __wildconf
|
splitwcs "$__shellconf" __tmpconf __wildconf
|
||||||
if [ -n "$__wildconf" ]; then
|
if [ -n "$__wildconf" ]; then
|
||||||
|
@ -1729,7 +1761,7 @@ function runs_action_export() {
|
||||||
for __shellvar in "${__shellvars[@]}"; do
|
for __shellvar in "${__shellvars[@]}"; do
|
||||||
[ -n "${!__shellvar}" ] || continue
|
[ -n "${!__shellvar}" ] || continue
|
||||||
estep "... Copie de ${!__shellvar}"
|
estep "... Copie de ${!__shellvar}"
|
||||||
cpnovcs "$__value/${!__shellvar}" "$(dirname "$RUNSROOTDIR$__value/${!__shellvar}")"
|
"$__cpcmd" "$__value/${!__shellvar}" "$(dirname "$RUNSROOTDIR$__value/${!__shellvar}")"
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
)
|
)
|
||||||
|
@ -1740,7 +1772,6 @@ function runs_action_export() {
|
||||||
estep "Vérification du répertoire $(ppath "$__value")"
|
estep "Vérification du répertoire $(ppath "$__value")"
|
||||||
mkdirof "$RUNSROOTDIR$__value"
|
mkdirof "$RUNSROOTDIR$__value"
|
||||||
(
|
(
|
||||||
__CPNOVCS_RSYNC_ARGS=(--copy-unsafe-links)
|
|
||||||
splitwcs "$__lineconf" __tmpconf __wildconf
|
splitwcs "$__lineconf" __tmpconf __wildconf
|
||||||
if [ -n "$__wildconf" ]; then
|
if [ -n "$__wildconf" ]; then
|
||||||
array_lsall __lineconfs "$__tmpconf" "$__wildconf"
|
array_lsall __lineconfs "$__tmpconf" "$__wildconf"
|
||||||
|
@ -1752,15 +1783,15 @@ function runs_action_export() {
|
||||||
array_from_lines __relpaths "$(<"$__lineconf" filter_conf)"
|
array_from_lines __relpaths "$(<"$__lineconf" filter_conf)"
|
||||||
for __relpath in "${__relpaths[@]}"; do
|
for __relpath in "${__relpaths[@]}"; do
|
||||||
estep "... Copie de $__relpath"
|
estep "... Copie de $__relpath"
|
||||||
cpnovcs "$__value/$__relpath" "$(dirname "$RUNSROOTDIR$__value/$__relpath")"
|
"$__cpcmd" "$__value/$__relpath" "$(dirname "$RUNSROOTDIR$__value/$__relpath")"
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
)
|
)
|
||||||
elif [ ! -e "$RUNSROOTDIR$__value" ]; then
|
else
|
||||||
# copie standard
|
# copie standard
|
||||||
estep "Copie de $(ppath "$__value")"
|
estep "Copie de $(ppath "$__value")"
|
||||||
mkdirof "$RUNSROOTDIR$__value"
|
mkdirof "$RUNSROOTDIR$__value"
|
||||||
cpnovcs "$__value" "$(dirname "$RUNSROOTDIR$__value")"
|
"$__cpcmd" "$__value" "$(dirname "$RUNSROOTDIR$__value")"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue