diff options
author | Nicolas Vigier <boklm@mageia.org> | 2013-06-13 12:44:57 +0000 |
---|---|---|
committer | Nicolas Vigier <boklm@mageia.org> | 2013-06-13 12:44:57 +0000 |
commit | 7aef72e3e486c3146c7b1e315c82b2a01de81552 (patch) | |
tree | 7bac4327486985e0fba16bd93b84c5d7b826c925 | |
parent | dbb60f26899720e6931840d8a7194ca8669ad154 (diff) | |
download | mgaadvisories-7aef72e3e486c3146c7b1e315c82b2a01de81552.tar mgaadvisories-7aef72e3e486c3146c7b1e315c82b2a01de81552.tar.gz mgaadvisories-7aef72e3e486c3146c7b1e315c82b2a01de81552.tar.bz2 mgaadvisories-7aef72e3e486c3146c7b1e315c82b2a01de81552.tar.xz mgaadvisories-7aef72e3e486c3146c7b1e315c82b2a01de81552.zip |
Add list command to list advisories
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | lib/MGA/Advisories.pm | 6 | ||||
-rwxr-xr-x | mgaadv | 16 |
3 files changed, 24 insertions, 1 deletions
@@ -1,4 +1,5 @@ -- add command to add a new advisory +- add 'new' command to add a new advisory +- add 'list' command to list advisories Version 0.4 diff --git a/lib/MGA/Advisories.pm b/lib/MGA/Advisories.pm index c5a31e1..f32625a 100644 --- a/lib/MGA/Advisories.pm +++ b/lib/MGA/Advisories.pm @@ -227,4 +227,10 @@ sub newadv { return $file; } +sub listadv { + my ($advdb) = @_; + print map { "$_: $advdb->{advisories}{$_}{subject}\n" } + sort keys %{$advdb->{advisories}}; +} + 1; @@ -5,6 +5,15 @@ use MGA::Advisories; use Template; my %actions = ( + list => { + run => \&listadv, + descr => 'List advisories', + usage => <<END, +$0 list + +Print the list of published advisories +END + }, mksite => { run => \&mksite, descr => 'Generates the advisories web site', @@ -71,6 +80,13 @@ sub newadv { } } +sub listadv { + usageexit('usage', $_[0]) unless @_ == 1; + my %advdb; + $advdb{advisories} = MGA::Advisories::get_advisories(); + MGA::Advisories::listadv(\%advdb); +} + if (@ARGV == 0 || !$actions{$ARGV[0]}) { usageexit(); } |