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() {
|
||||
local var=value value
|
||||
[[ "$1" != *=* ]] && { var="$1"; shift; }
|
||||
local vvalue=value value vfile=file file
|
||||
[[ "$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
|
||||
case "$1" in
|
||||
basedir=*) basedir="${1#basedir=}";;
|
||||
path=*) path="${1#path=}";;
|
||||
extract=*) extract="${1#extract=}";;
|
||||
add-prefix=*) add_prefix="${1#add-prefix=}";;
|
||||
|
@ -1203,7 +1205,9 @@ function from_glob() {
|
|||
esac
|
||||
shift
|
||||
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//\*/(.*)}"
|
||||
if [ -n "$extract" ]; then
|
||||
extract="${extract//\//\\/}"
|
||||
|
@ -1213,7 +1217,7 @@ function from_glob() {
|
|||
}")$add_suffix"
|
||||
fi
|
||||
|
||||
local "$var"; upvar "$var" "$value"
|
||||
local "$vvalue" "$vfile"; upvars "$vvalue" "$value" "$vfile" "$file"
|
||||
}
|
||||
function define_functions_env() {
|
||||
function setversion() {
|
||||
|
|
Loading…
Reference in New Issue