maj des inclusions

This commit is contained in:
2014-08-28 10:14:35 +04:00
parent fcf60b2bca
commit f200c7ec66
2 changed files with 119 additions and 39 deletions

View File

@@ -108,6 +108,12 @@ function nef() {
"$@" | sed '/^$/d'
}
function tolower() {
echo ${*,,}
}
function toupper() {
echo ${*^^}
}
function isnum() {
[ ${#1} -gt 0 ] || return 1
local v="$1"
@@ -1644,9 +1650,9 @@ function array_deli(dest, i, l) {
}
delete dest[l]
}
function array_del(dest, value, i) {
function array_del(dest, value, ignoreCase, i) {
do {
i = key_index(value, dest)
i = key_index(value, dest, ignoreCase)
if (i != 0) array_deli(dest, i)
} while (i != 0)
}
@@ -2273,8 +2279,7 @@ function __po_process_options() {
function __genparse_shortopt() {
local LC_COLLATE=C
local shortopt="${1//[^A-Z]}"
shortopt="${shortopt:0:1}"
shortopt="${shortopt,,}"
shortopt="$(tolower "${shortopt:0:1}")"
[ -n "$shortopt" ] && echo "$shortopt"
}
HELP_DESC=
@@ -2289,7 +2294,7 @@ function genparse() {
if [[ "$var" == *=* ]]; then
splitvar "$var" name value
shortopt="$(__genparse_shortopt "$name")"
option="${name,,}"
option="$(tolower "$name")"
name="${option//-/_}"
array_add names "$name"
array_add descs "${shortopt:+-$shortopt, }--$option VALUE"
@@ -2298,7 +2303,7 @@ function genparse() {
else
name="$var"
shortopt="$(__genparse_shortopt "$name")"
option="${name,,}"
option="$(tolower "$name")"
name="${option//-/_}"
array_add names "$name"
array_add descs "${shortopt:+-$shortopt, }--$option"
@@ -3594,6 +3599,22 @@ if check_sysinfos -s macosx; then
function _nl2crlf() { _nl2lf | awk '{ print $0 "\r" }'; }
function _nl2cr() { _nl2lf | awk 'BEGIN { ORS="" } { print $0 "\r" }'; }
function sedi() { sed -i '' "$@"; }
function tolower() { tr A-Z a-z <<<"$*"; }
function toupper() { tr a-z A-Z <<<"$*"; }
function is_yes() {
case "$(tolower "$1")" in
o|oui|y|yes|v|vrai|t|true|on) return 0;;
esac
isnum "$1" && [ "$1" -ne 0 ] && return 0
return 1
}
function is_no() {
case "$(tolower "$1")" in
n|non|no|f|faux|false|off) return 0;;
esac
isnum "$1" && [ "$1" -eq 0 ] && return 0
return 1
}
function __po_check_options() {
local -a options args