deploy: support des options --of, --df, --lf

This commit is contained in:
Jephté Clain 2017-04-19 00:35:07 +04:00
parent c1a536be52
commit 3bbabbf811
1 changed files with 11 additions and 6 deletions

View File

@ -30,8 +30,8 @@ function deploy_query_recursive() {
function deploy_query_once() {
# Afficher le résultat d'une requête
local alv sov slv sdv
eval "set -- $(getopt -ov:old -lallow-vars:,object-vars,link-vars,dest-vars -- "$@")"
local alv sov sdv slv sof sdf slf
eval "set -- $(getopt -ov:odl -lallow-vars:,object-vars,dest-vars,link-vars,of:,object-func:,df:,dest-func:,lf:,link-func: -- "$@")"
while [ -n "$1" ]; do
case "$1" in
-v|--allow-vars)
@ -39,8 +39,11 @@ function deploy_query_once() {
shift; shift
;;
-o|--object-vars) sov=1; shift;;
-l|--link-vars) slv=1; shift;;
-d|--dest-vars) sdv=1; shift;;
-l|--link-vars) slv=1; shift;;
--of|--object-func) sof="$2"; shift; shift;;
--df|--dest-func) sdf="$2"; shift; shift;;
--lf|--link-func) slf="$2"; shift; shift;;
--) shift; break;;
*) break;;
esac
@ -98,7 +101,7 @@ function deploy_query_once() {
if [ -n "$sov" ]; then
deploy_copy_object_values vs "$object" "$type"
deploy_show_values vs "$type" "$format" shell alv
deploy_show_attrs "$object" "$type" "$format" alv vars
deploy_show_attrs "$object" "$type" "$format" alv vars "$sof"
fi
if [ -n "$sdv" ]; then
local -a pons pgns ons gns ans ovs os; local an av o
@ -107,10 +110,10 @@ function deploy_query_once() {
for hv in "${hvs[@]}"; do
deploy_copy_object_values hs "$hv" host
deploy_show_values hs host "$format" shell alv
deploy_show_attrs "$hn" host "$format" alv vars
deploy_show_attrs "$hn" host "$format" alv vars "$sdf"
done
fi
deploy_show_links "$object" "$link" "$profile" "$format" "" alv vars
deploy_show_links "$object" "$link" "$profile" "$format" "" alv vars "$slf"
[ "$format" == shell ] && echo true
return 0
;;
@ -295,6 +298,7 @@ function deploy_show_attrs() {
deploy_copy_attr_values vs "$an" "$o" "$t" ons
deploy_dump_values "$an" vs
done
[ -n "$6" ] && echo "$6"
}
function deploy_show_links() {
@ -329,6 +333,7 @@ function deploy_show_links() {
deploy_show_values avs "$an" "$f" shell alv
fi
done
[ -n "$8" -a "$f" == shell ] && echo "$8"
done
}