diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2009-06-18 21:34:16 +0200 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2009-06-18 21:34:16 +0200 |
commit | deb20257d6553cf6f0825d539653c053150e18ef (patch) | |
tree | abe1dea61699d5edbcaf7540fbe70544d37f9fc5 | |
parent | c5bd347bf9efb7a9db79cfb059fd952452077a7a (diff) |
apt-why: Added --depth to specify the maximum recursion depth
-rwxr-xr-x | bin/apt-why | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/bin/apt-why b/bin/apt-why index 37d0fde..d6e50c1 100755 --- a/bin/apt-why +++ b/bin/apt-why @@ -9,10 +9,12 @@ use Getopt::Long; my $cache = AptPkg::Cache->new; my $not = 0; +my $max_depth = 5; my @deptypes; GetOptions( 'not' => \$not, 'deptype=s' => \@deptypes, + 'depth=i' => \$max_depth, ); my $packagename = shift or die("No packagename given"); my @known; @@ -41,10 +43,10 @@ sub revdeps { sub recurse { my $name = shift; - my $level = (shift) + 1; - printf("%s%s\n", " " x ($level-1), $name); - return if ($level >= 5); - recurse($_, $level) foreach revdeps($name); + my $depth = (shift) + 1; + printf("%s%s\n", " " x ($depth-1), $name); + return if ($depth >= $max_depth); + recurse($_, $depth) foreach revdeps($name); } recurse($packagename, 0); @@ -68,6 +70,10 @@ showing which packages require I<package> on the system. =over +=item B<--depth>=I<integer> (default: 5) + +Specify the maximum recursion depth + =item B<--deptype>=I<types> Only show reverse dependency which mach the specified I<types> (comma separated list). |