diff options
author | Colin Watson <cjwatson@debian.org> | 2009-08-13 09:03:34 +0100 |
---|---|---|
committer | Joey Hess <joey@gnu.kitenet.net> | 2009-08-16 12:36:32 -0400 |
commit | 48ca954737890ff4661fbf88a8d90102bc85a1ec (patch) | |
tree | b477c432ab9d02055a239e75d9b5b6cb42ac77c0 /dh | |
parent | 639fd291e5c5b11f08af6d64c6966fc0e0655a70 (diff) |
dh: Add --list option to list available addons.
Diffstat (limited to 'dh')
-rwxr-xr-x | dh | 32 |
1 files changed, 31 insertions, 1 deletions
@@ -8,10 +8,11 @@ dh - debhelper command sequencer use strict; use Debian::Debhelper::Dh_Lib; +use File::Spec; =head1 SYNOPSIS -B<dh> sequence [B<--with> I<addon>[,I<addon>,...]] [B<--until> I<cmd>] [B<--before> I<cmd>] [B<--after> I<cmd>] [B<--remaining>] [S<I<debhelper options>>] +B<dh> sequence [B<--with> I<addon>[,I<addon>,...]] [B<--list>] [B<--until> I<cmd>] [B<--before> I<cmd>] [B<--after> I<cmd>] [B<--remaining>] [S<I<debhelper options>>] =head1 DESCRIPTION @@ -58,6 +59,10 @@ the sequence addon interface. The inverse of --with, disables using the given addon. +=item B<--list>, B<-l> + +List all available addons. + =item B<--until> I<cmd> Run commands in the sequence until and including I<cmd>, then stop. @@ -216,6 +221,8 @@ init(options => { my ($option,$value)=@_; @{$dh{WITH}} = grep { $_ ne $value } @{$dh{WITH}}; }, + "l" => \$dh{LIST}, + "list" => \$dh{LIST}, }); inhibit_log(); @@ -327,6 +334,29 @@ sub add_command { my $sequence=shift; unshift @{$sequences{$sequence}}, $command; } + +if ($dh{LIST}) { + my %addons; + + for my $inc (@INC) { + my $path = File::Spec->catdir($inc, "Debian/Debhelper/Sequence"); + if (-d $path) { + for my $module_path (glob "$path/*.pm") { + my $name = basename($module_path); + $name =~ s/\.pm$//; + $name =~ s/_/-/g; + $addons{$name} = 1; + } + } + } + + for my $name (sort keys %addons) { + print "$name\n"; + } + + exit 0; +} + foreach my $addon (@{$dh{WITH}}) { my $mod="Debian::Debhelper::Sequence::$addon"; $mod=~s/-/_/g; |