From 839a4d3a821ff46c0ace573a77c16b82a9a16ca1 Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Tue, 1 Dec 2020 14:12:27 +0000 Subject: [PATCH 1/2] doc/arch-audit.1: Fix description of -f --- doc/arch-audit.1 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/arch-audit.1 b/doc/arch-audit.1 index 069a33e..171cfe4 100644 --- a/doc/arch-audit.1 +++ b/doc/arch-audit.1 @@ -66,15 +66,15 @@ Specify a format to control the output. Placeholders are .B %n (pkgname), .B %c -(CVEs) and +(CVEs), .B %v -(fixed version) and +(fixed version), +.B %t +(type), and .B %r -(required by) which is only evaluated when +(required by, which is only evaluated when .B --recursive -is also set. -.B %t -(type), +is also set). .RE \fI-c, --show-cve\fR From e4dee38174ea74063e2fee0f3a29b1ca941c2628 Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Tue, 1 Dec 2020 14:22:16 +0000 Subject: [PATCH 2/2] Add %s (severity) to --format --- doc/arch-audit.1 | 4 +++- src/cli.yml | 2 +- src/main.rs | 10 ++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/doc/arch-audit.1 b/doc/arch-audit.1 index 171cfe4..0d4a81c 100644 --- a/doc/arch-audit.1 +++ b/doc/arch-audit.1 @@ -70,7 +70,9 @@ Specify a format to control the output. Placeholders are .B %v (fixed version), .B %t -(type), and +(type), +.B %s +(severity), and .B %r (required by, which is only evaluated when .B --recursive diff --git a/src/cli.yml b/src/cli.yml index 2aec2c3..083f754 100644 --- a/src/cli.yml +++ b/src/cli.yml @@ -22,7 +22,7 @@ args: short: f long: format takes_value: true - help: Specify a format to control the output. Placeholders are %n (pkgname), %c (CVEs), %v (fixed version), %t (type) and %r (required by, only when -r is also used). + help: Specify a format to control the output. Placeholders are %n (pkgname), %c (CVEs), %v (fixed version), %t (type), %s (severity), and %r (required by, only when -r is also used). - quiet: short: q long: quiet diff --git a/src/main.rs b/src/main.rs index 2e09a64..2163901 100644 --- a/src/main.rs +++ b/src/main.rs @@ -390,6 +390,16 @@ fn print_affected_formatted( } chars.next(); } + Some('s') => { + write_with_colours( + t, + &aff.severity.to_string(), + options, + Some(aff.severity.to_color()), + None, + ); + chars.next(); + } Some('t') => { if !aff.kind.is_empty() { write!(t, "{}", aff.kind.join(", ")).expect("term::write failed");