diff options
author | Nicolas Vigier <boklm@mageia.org> | 2013-06-13 12:45:00 +0000 |
---|---|---|
committer | Nicolas Vigier <boklm@mageia.org> | 2013-06-13 12:45:00 +0000 |
commit | 0268da9024bc8b59551929983c967f9c5aaf6b0c (patch) | |
tree | 380ff636d0edc8066c3ca35b75abbdd365e55409 /lib | |
parent | 7aef72e3e486c3146c7b1e315c82b2a01de81552 (diff) | |
download | mgaadvisories-0268da9024bc8b59551929983c967f9c5aaf6b0c.tar mgaadvisories-0268da9024bc8b59551929983c967f9c5aaf6b0c.tar.gz mgaadvisories-0268da9024bc8b59551929983c967f9c5aaf6b0c.tar.bz2 mgaadvisories-0268da9024bc8b59551929983c967f9c5aaf6b0c.tar.xz mgaadvisories-0268da9024bc8b59551929983c967f9c5aaf6b0c.zip |
Add 'show' command to show an advisory
Diffstat (limited to 'lib')
-rw-r--r-- | lib/MGA/Advisories.pm | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/MGA/Advisories.pm b/lib/MGA/Advisories.pm index f32625a..ac7a734 100644 --- a/lib/MGA/Advisories.pm +++ b/lib/MGA/Advisories.pm @@ -233,4 +233,25 @@ sub listadv { sort keys %{$advdb->{advisories}}; } +sub showadv { + my ($advdb, $adv) = @_; + if (!$advdb->{advisories}{$adv}) { + print STDERR "Cannot find advisory $adv\n"; + return undef; + } + my $template = Template->new( + INCLUDE_PATH => $config->{tmpl_dir}, + ); + my $vars = { + config => $config, + advisory => $adv, + advdb => $advdb, + basename => \%basename, + tools => \%tools, + }; + my $advtxt; + process_template($template, 'advisory', $vars, \$advtxt, 'txt'); + print $advtxt; +} + 1; |