modifs.mineures sans commentaires
This commit is contained in:
parent
a1f88e9d38
commit
af332ea961
|
@ -44,6 +44,9 @@ usage
|
|||
USAGE
|
||||
\$MYNAME [options] FILE
|
||||
~~~
|
||||
Peut contenir autant de lignes que nécessaire. Chaque ligne est préfixée du
|
||||
nom du script, jusqu'à la première ligne vide. Ensuite, les lignes sont
|
||||
affichées telles quelles.
|
||||
|
||||
+|-
|
||||
: méthode d'analyse des arguments.
|
||||
|
@ -236,21 +239,33 @@ function __parse_args() {
|
|||
help="$help: $__DESC"
|
||||
fi
|
||||
|
||||
local first usage nl=$'\n'
|
||||
local prefix=" $MYNAME "
|
||||
local -a usages; local usage="$__USAGE"
|
||||
[ -n "$usage" ] || usage="[options]"
|
||||
IFS=$'\n' read -a usages -d "" <<<"$usage"
|
||||
local usages="$__USAGE"
|
||||
[ -n "$usages" ] || usages="[options]"
|
||||
help="$help
|
||||
|
||||
USAGE"
|
||||
for usage in "${usages[@]}"; do
|
||||
[ -n "$usage" ] || continue
|
||||
first=1
|
||||
while [ -n "$usages" ]; do
|
||||
usage="${usages%%$nl*}"
|
||||
if [ "$usage" != "$usages" ]; then
|
||||
usages="${usages#*$nl}"
|
||||
else
|
||||
usages=
|
||||
fi
|
||||
if [ -n "$first" ]; then
|
||||
first=
|
||||
[ -z "$usage" ] && continue
|
||||
else
|
||||
[ -z "$usage" ] && prefix=
|
||||
fi
|
||||
help="$help
|
||||
$prefix$usage"
|
||||
done
|
||||
|
||||
set -- "${__DEFS[@]}"
|
||||
local first=1
|
||||
first=1
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
+) shift; continue;;
|
||||
|
|
Loading…
Reference in New Issue