mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-01-26 12:35:20 +00:00
Improve output from make/cmake wrapper
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
parent
0fa6b36257
commit
90dbba5385
@ -18,13 +18,32 @@ TOOL=$(basename "$0")
|
|||||||
# Locate original tool
|
# Locate original tool
|
||||||
ORIGINAL_TOOL=$(type -ap ${TOOL} | grep -v "$0" | head -n1 )
|
ORIGINAL_TOOL=$(type -ap ${TOOL} | grep -v "$0" | head -n1 )
|
||||||
|
|
||||||
|
quote_args() {
|
||||||
|
# similar to printf '%q' "$@"
|
||||||
|
# but produce more human-readable results for common/simple cases like "a b"
|
||||||
|
local args=("$@")
|
||||||
|
s=""
|
||||||
|
for a in "${args[@]}"; do
|
||||||
|
simple_pattern='^[[:alnum:] _=+-]*$'
|
||||||
|
if [[ $a =~ ' ' && $a =~ $simple_pattern ]]; then
|
||||||
|
# a has spaces, but no other special characters that need escaping
|
||||||
|
# (quoting after removing spaces yields no backslashes)
|
||||||
|
# simplify quoted form to "$a" - e.g. yield "a b c" instead of a\ b\ c
|
||||||
|
q="\"$a\""
|
||||||
|
else
|
||||||
|
# get bash to do the quoting
|
||||||
|
q=$(printf '%q' "$a")
|
||||||
|
fi
|
||||||
|
s="$s $q"
|
||||||
|
done
|
||||||
|
echo $s
|
||||||
|
}
|
||||||
|
|
||||||
if [[ ! " $@ " =~ " --version " ]]; then
|
if [[ ! " $@ " =~ " --version " ]]; then
|
||||||
# Display the command being invoked - if it succeeds, this is all that will
|
# Display the command being invoked - if it succeeds, this is all that will
|
||||||
# be displayed. Don't do this for invocations with --version, because
|
# be displayed. Don't do this for invocations with --version, because
|
||||||
# this output is often parsed by scripts, so we don't want to modify it.
|
# this output is often parsed by scripts, so we don't want to modify it.
|
||||||
echo -n "${TOOL} "
|
echo "${TOOL} $(quote_args "$@")"
|
||||||
printf '%q ' "$@"
|
|
||||||
echo
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ " $@ " =~ $NO_SILENCE || -n "${VERBOSE_LOGS}" ]]; then
|
if [[ " $@ " =~ $NO_SILENCE || -n "${VERBOSE_LOGS}" ]]; then
|
||||||
|
@ -18,13 +18,32 @@ TOOL=$(basename "$0")
|
|||||||
# Locate original tool
|
# Locate original tool
|
||||||
ORIGINAL_TOOL=$(type -ap ${TOOL} | grep -v "$0" | head -n1 )
|
ORIGINAL_TOOL=$(type -ap ${TOOL} | grep -v "$0" | head -n1 )
|
||||||
|
|
||||||
|
quote_args() {
|
||||||
|
# similar to printf '%q' "$@"
|
||||||
|
# but produce more human-readable results for common/simple cases like "a b"
|
||||||
|
local args=("$@")
|
||||||
|
s=""
|
||||||
|
for a in "${args[@]}"; do
|
||||||
|
simple_pattern='^[[:alnum:] _=+-]*$'
|
||||||
|
if [[ $a =~ ' ' && $a =~ $simple_pattern ]]; then
|
||||||
|
# a has spaces, but no other special characters that need escaping
|
||||||
|
# (quoting after removing spaces yields no backslashes)
|
||||||
|
# simplify quoted form to "$a" - e.g. yield "a b c" instead of a\ b\ c
|
||||||
|
q="\"$a\""
|
||||||
|
else
|
||||||
|
# get bash to do the quoting
|
||||||
|
q=$(printf '%q' "$a")
|
||||||
|
fi
|
||||||
|
s="$s $q"
|
||||||
|
done
|
||||||
|
echo $s
|
||||||
|
}
|
||||||
|
|
||||||
if [[ ! " $@ " =~ " --version " ]]; then
|
if [[ ! " $@ " =~ " --version " ]]; then
|
||||||
# Display the command being invoked - if it succeeds, this is all that will
|
# Display the command being invoked - if it succeeds, this is all that will
|
||||||
# be displayed. Don't do this for invocations with --version, because
|
# be displayed. Don't do this for invocations with --version, because
|
||||||
# this output is often parsed by scripts, so we don't want to modify it.
|
# this output is often parsed by scripts, so we don't want to modify it.
|
||||||
echo -n "${TOOL} "
|
echo "${TOOL} $(quote_args "$@")"
|
||||||
printf '%q ' "$@"
|
|
||||||
echo
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ " $@ " =~ $NO_SILENCE || -n "${VERBOSE_LOGS}" ]]; then
|
if [[ " $@ " =~ $NO_SILENCE || -n "${VERBOSE_LOGS}" ]]; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user