1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-11-11 03:54:59 -05:00

contrib/pactree: fix option parsing

The option parsing was catching any "-d" in an argument so packages
with this in their name did not work.

Also removed commented code line that appears to be inserted during
testing.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Allan McRae 2008-12-04 23:20:24 +10:00 committed by Dan McGee
parent a1f7c83dbf
commit b373b1d16b

View File

@ -208,11 +208,10 @@ for (( n=0 ; n < $len_options ; n++ )); do
continue continue
fi fi
if [[ "${options[$n]}" =~ -d[[:digit:]]* || "${options[$n]}" == "--depth" ]]; then if [[ "${options[$n]}" =~ -d[[:digit:]]+ || "${options[$n]}" == "--depth" ]]; then
if [[ "${options[$n]#-d}" =~ [[:digit:]]+ ]]; then if [[ "${options[$n]#-d}" =~ [[:digit:]]+ ]]; then
max_depth="${options[$n]#-d}" max_depth="${options[$n]#-d}"
elif [[ ${options[$((n+1))]} =~ [[:digit:]]+ ]]; then elif [[ ${options[$((n+1))]} =~ [[:digit:]]+ ]]; then
# if [ ${options[$((n+1))]} -eq ${options[$((n+1))]} 2>/dev/null ]; then
max_depth="${options[$((n+1))]}" max_depth="${options[$((n+1))]}"
unset options[$((n+1))] unset options[$((n+1))]
((++n)) ((++n))