Skip to content

Commit

Permalink
Do not print packages with state Vulnerable when upgradable_only is set
Browse files Browse the repository at this point in the history
  • Loading branch information
Arvedui committed Mar 9, 2018
1 parent 54b7bb8 commit f787aa5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ impl fmt::Display for Severity {
}
}

#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd)]
pub enum Status {
Unknown,
NotAffected,
Vulnerable,
Testing,
Fixed,
NotAffected,
Testing,
}

impl FromStr for Status {
Expand Down
9 changes: 4 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,8 @@ fn merge_avgs(
avg_severity = a.severity;
}

// We only care about testing stuff
if a.status == enums::Status::Testing {
avg_status = a.status.clone();
if a.status > avg_status {
avg_status = a.status;
}
}

Expand Down Expand Up @@ -365,7 +364,7 @@ fn test_merge_avgs() {
fn print_avgs(options: &Options, avgs: &BTreeMap<String, avg::AVG>) {
for (pkg, avg) in avgs {
match avg.fixed {
Some(ref v) => {
Some(ref v) if avg.status != enums::Status::Vulnerable => {
if options.quiet >= 2 {
println!("{}", pkg);
} else if options.quiet == 1 {
Expand Down Expand Up @@ -403,7 +402,7 @@ fn print_avgs(options: &Options, avgs: &BTreeMap<String, avg::AVG>) {
}
}
}
None => {
_ => {
if !options.upgradable_only {
if options.quiet > 0 {
println!("{}", pkg);
Expand Down

0 comments on commit f787aa5

Please sign in to comment.