summaryrefslogtreecommitdiff
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
parent9ed5424a5563a73700852a290e2b5ebbfb554289 (diff)
Added --tabwidth option; indent with tabs by default
-rwxr-xr-xbin/apt-why21
-rw-r--r--provides/zsh/completions/_apt-why1
2 files changed, 17 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
diff --git a/provides/zsh/completions/_apt-why b/provides/zsh/completions/_apt-why
index 20c39bb..78391ca 100644
--- a/provides/zsh/completions/_apt-why
+++ b/provides/zsh/completions/_apt-why
@@ -22,6 +22,7 @@ arguments=(
'--all[consider all available packages]'
'--depth=-[recursion depth]:recursion depth'
'--deptype[filter by dependency type]:dependency type:_apt-why_deptype'
+ '--tabwidth=-[spaces per recursion level]:spaces per recursion level'
'*:package:_deb_packages "" avail'
)