summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-09-07 23:19:55 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-09-07 23:19:55 +0000
commit76d8c58f091b5a2c2250e6b1e507f604632a2da6 (patch)
tree1bb90e00721043703ac5f5125403c328c5c5f26d
parentbfff438589baec0808e649f734a184f52ca4ee0f (diff)
Add "list" and usage to modulemanager [danieldg]
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10465 e03df62e-2008-0410-955e-edbf42e46eb7
-rwxr-xr-xmodulemanager30
1 files changed, 27 insertions, 3 deletions
diff --git a/modulemanager b/modulemanager
index 4d9cba456..0d5d1fd16 100755
--- a/modulemanager
+++ b/modulemanager
@@ -118,8 +118,8 @@ sub ver_in_range {
return 1 unless defined $range;
if ($range =~ /(.*)-(.*)/) {
my($l,$h) = ($1,$2);
- return 0 unless ver_cmp($ver, $l) >= 0;
- return 0 unless ver_cmp($ver, $h) <= 0;
+ return 0 if $l && ver_cmp($ver, $l) < 0;
+ return 0 if $h && ver_cmp($ver, $h) > 0;
return 1;
}
return !ver_cmp($ver, $range);
@@ -211,8 +211,32 @@ if ($action eq 'install') {
%todo = %saved;
}
}
+} elsif ($action eq 'list') {
+ my @all = sort keys %modules;
+ for my $mod (@all) {
+ my @vers = sort { ver_cmp() } keys %{$modules{$mod}};
+ my $desc = '';
+ for my $ver (@vers) {
+ # latest defined description wins
+ $desc = $modules{$mod}{$ver}{description} || $desc;
+ }
+ next if @vers == 1 && $modules{$mod}{$vers[0]}{url} eq 'NONE';
+ my $instver = $installed{$mod} || '';
+ my $vers = join ' ', map { $_ eq $instver ? "\e[1m$_\e[m" : $_ } @vers;
+ print "$mod ($vers) - $desc\n";
+ }
} else {
- die "Unknown action $action"
+ print <<ENDUSAGE
+Use: $0 <action> <args>
+Action is one of the following
+ install install new modules
+ upgrade upgrade installed modules
+ list lists available modules
+
+For installing a package, specify its name or name=version to force the
+installation of a specific version.
+ENDUSAGE
+;exit 1;
}
resolve_deps(0);