diff options
author | Daniel <kingdread@gmx.de> | 2019-02-16 01:48:59 +0100 |
---|---|---|
committer | Daniel <kingdread@gmx.de> | 2019-02-16 01:48:59 +0100 |
commit | dfbf78622b0869f070d062b3edd40c4a97ce7dfd (patch) | |
tree | 980e0fc50f5b0e89210a0d086fb9ee87c1e73f51 /src/filters.rs | |
parent | 2fb14e9e5c5e48c3231f6d4aa324917d0dd3ccf7 (diff) | |
download | raidgrep-dfbf78622b0869f070d062b3edd40c4a97ce7dfd.tar.gz raidgrep-dfbf78622b0869f070d062b3edd40c4a97ce7dfd.tar.bz2 raidgrep-dfbf78622b0869f070d062b3edd40c4a97ce7dfd.zip |
introduce CommaSeparatedList
This gives a common interface for command line flags which take multiple
values, possibly with negation.
This might come in useful if we add filtering by boss, e.g. "--boss
!deimos" to ignore all deimos logs.
Diffstat (limited to 'src/filters.rs')
-rw-r--r-- | src/filters.rs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/filters.rs b/src/filters.rs index 6980900..f9db377 100644 --- a/src/filters.rs +++ b/src/filters.rs @@ -1,6 +1,6 @@ use evtclib::{AgentName, Log}; -use super::{LogResult, Opt}; +use super::{SearchField, FightOutcome, LogResult, Opt}; /// Do filtering based on the character or account name. pub fn filter_name(log: &Log, opt: &Opt) -> bool { @@ -11,8 +11,8 @@ pub fn filter_name(log: &Log, opt: &Opt) -> bool { character_name, .. } => { - if (opt.field.search_account() && opt.expression.is_match(account_name)) - || (opt.field.search_character() && opt.expression.is_match(character_name)) + if (opt.field.contains(&SearchField::Account) && opt.expression.is_match(account_name)) + || (opt.field.contains(&SearchField::Character) && opt.expression.is_match(character_name)) { return true; } @@ -25,11 +25,7 @@ pub fn filter_name(log: &Log, opt: &Opt) -> bool { /// Do filtering based on the fight outcome. pub fn filter_outcome(result: &LogResult, opt: &Opt) -> bool { - match opt.outcome { - Some(o) if o == result.outcome => true, - None => true, - _ => false, - } + opt.outcome.contains(&result.outcome) } /// Do filtering based on encounter time. |