summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2009-09-20 11:20:21 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2009-09-20 11:20:21 +0200
commit8ff347ad957b2174c56747a7d9bffa53fad1b228 (patch)
tree2586cbbbbf8d41bff7e6adc344d9a61fb02c375b /bin
parent9ed5424a5563a73700852a290e2b5ebbfb554289 (diff)
Added --tabwidth option; indent with tabs by default
Diffstat (limited to 'bin')
-rwxr-xr-xbin/apt-why21
1 files changed, 16 insertions, 5 deletions
diff --git a/bin/apt-why b/bin/apt-why
index 991449c..e0e4123 100755
--- a/bin/apt-why
+++ b/bin/apt-why
@@ -10,12 +10,15 @@ use Getopt::Long;
my $cache = AptPkg::Cache->new;
my $max_depth = 5;
my $all = 0;
+my $tabwidth;
+my $tabsign = "\t";
my @deptypes = ('Depends', 'Recommends', 'Suggests');
GetOptions(
- 'all!' => \$all,
- 'deptype=s' => sub {@deptypes = split(/,/, $_[1])},
- 'depth=i' => \$max_depth,
- 'h|?|help' => \&usage,
+ 'all!' => \$all,
+ 'deptype=s' => sub {@deptypes = split(/,/, $_[1])},
+ 'depth=i' => \$max_depth,
+ 'tabwidth=i' => \$tabwidth,
+ 'h|?|help' => \&usage,
);
my $packagename = shift or die("No packagename given");
my @known;
@@ -48,7 +51,7 @@ sub recurse {
my $name = shift;
my $depth = (shift) + 1;
- printf("%s%s\n", " " x ($depth-1), $name);
+ printf("%s%s\n", $tabsign x ($depth-1), $name);
if ($depth >= $max_depth) {
return;
@@ -61,6 +64,10 @@ sub recurse {
return;
}
+if (defined $tabwidth) {
+ $tabsign = ' ' x $tabwidth;
+}
+
if (not defined $cache->{$packagename}) {
print STDERR "No such package: $packagename\n";
exit(1);
@@ -104,6 +111,10 @@ Specify the maximum recursion depth
Only show reverse dependency which mach the specified I<types> (comma separated list).
Right now, possible types are Depends, Suggests, Recommends.
+=item B<--tabwidth>=I<i>
+
+Indent each recursion level with I<i> spaces (by default: one tab)
+
=back
=head1 AUTHOR