dkbuild: améliorer from_glob()
This commit is contained in:
parent
5c03184c94
commit
e30820261a
14
dkbuild
14
dkbuild
|
@ -1188,12 +1188,14 @@ function load_environ() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function from_glob() {
|
function from_glob() {
|
||||||
local var=value value
|
local vvalue=value value vfile=file file
|
||||||
[[ "$1" != *=* ]] && { var="$1"; shift; }
|
[[ "$1" != *=* ]] && { vvalue="$1"; shift; }
|
||||||
|
[[ "$1" != *=* ]] && { vfile="$1"; shift; }
|
||||||
|
|
||||||
local path extract add_prefix add_suffix
|
local basedir path extract add_prefix add_suffix
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
basedir=*) basedir="${1#basedir=}";;
|
||||||
path=*) path="${1#path=}";;
|
path=*) path="${1#path=}";;
|
||||||
extract=*) extract="${1#extract=}";;
|
extract=*) extract="${1#extract=}";;
|
||||||
add-prefix=*) add_prefix="${1#add-prefix=}";;
|
add-prefix=*) add_prefix="${1#add-prefix=}";;
|
||||||
|
@ -1203,7 +1205,9 @@ function from_glob() {
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
value="$(list_all . "$path" | sort -rn | head -1)"
|
[ -n "$basedir" ] || basedir=.
|
||||||
|
value="$(list_all "$basedir" "$path" | sort -rn | head -1)"
|
||||||
|
file="$basedir/$value"
|
||||||
[ -n "$extract" ] || extract="${path//\*/(.*)}"
|
[ -n "$extract" ] || extract="${path//\*/(.*)}"
|
||||||
if [ -n "$extract" ]; then
|
if [ -n "$extract" ]; then
|
||||||
extract="${extract//\//\\/}"
|
extract="${extract//\//\\/}"
|
||||||
|
@ -1213,7 +1217,7 @@ function from_glob() {
|
||||||
}")$add_suffix"
|
}")$add_suffix"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local "$var"; upvar "$var" "$value"
|
local "$vvalue" "$vfile"; upvars "$vvalue" "$value" "$vfile" "$file"
|
||||||
}
|
}
|
||||||
function define_functions_env() {
|
function define_functions_env() {
|
||||||
function setversion() {
|
function setversion() {
|
||||||
|
|
Loading…
Reference in New Issue