From 51e11c2096c969e16fcf06c804b09347ce039c5b Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 19 Jun 2009 18:16:23 +0200 Subject: apt-why: Added --all option to consider all available packages --- bin/apt-why | 10 ++++++++-- provides/zsh/completions/_apt-why | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/bin/apt-why b/bin/apt-why index d27fef5..2d200e8 100755 --- a/bin/apt-why +++ b/bin/apt-why @@ -10,9 +10,11 @@ use Getopt::Long; my $cache = AptPkg::Cache->new; my $max_depth = 5; +my $all = 0; my @deptypes; my @default_deptypes = ('Depends', 'Recommends', 'Suggests'); GetOptions( + 'all!' => \$all, 'deptype=s' => \@deptypes, 'depth=i' => \$max_depth, ); @@ -31,7 +33,7 @@ sub revdeps { my $rdeps = $package->{RevDependsList}; foreach (@$rdeps) { if ( - $cache->{$_->{ParentPkg}{Name}}->{CurrentState} eq 'Installed' + ($all or $cache->{$_->{ParentPkg}{Name}}->{CurrentState} eq 'Installed') and "$_->{DepType}" ~~ @deptypes ) { next if ($_->{ParentPkg}{Name} ~~ @known); @@ -65,12 +67,16 @@ B [ I ] I =head1 DESCRIPTION B recursively displays I's reverse dependency, thus -showing which packages require I on the system. +showing which installed packages require I on the system. =head1 OPTIONS =over +=item B<--all> + +Consider all packages, not just installed ones + =item B<--depth>=I (default: 5) Specify the maximum recursion depth diff --git a/provides/zsh/completions/_apt-why b/provides/zsh/completions/_apt-why index ef02269..a014c45 100644 --- a/provides/zsh/completions/_apt-why +++ b/provides/zsh/completions/_apt-why @@ -7,6 +7,7 @@ typeset -a arguments arguments=( + '--all[consider all available packages]' '--depth=-[recursion depth]:recursion depth' '*--deptype=-[filter by dependency type]:dependency type:(Depends Recommends Suggests)' '*:package:_deb_packages "" avail' -- cgit v1.2.3