From 0268da9024bc8b59551929983c967f9c5aaf6b0c Mon Sep 17 00:00:00 2001 From: Nicolas Vigier Date: Thu, 13 Jun 2013 12:45:00 +0000 Subject: Add 'show' command to show an advisory --- lib/MGA/Advisories.pm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'lib') 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; -- cgit v1.2.1