diff options
-rwxr-xr-x | modulemanager | 30 |
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); |