From 76d8c58f091b5a2c2250e6b1e507f604632a2da6 Mon Sep 17 00:00:00 2001 From: w00t Date: Sun, 7 Sep 2008 23:19:55 +0000 Subject: Add "list" and usage to modulemanager [danieldg] git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10465 e03df62e-2008-0410-955e-edbf42e46eb7 --- modulemanager | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'modulemanager') 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 < +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); -- cgit v1.2.3