diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-01-25 11:02:59 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-01-25 11:02:59 +0100 |
commit | 50df30dfea10a3c1ee6fe8de9856fdb4596a08fe (patch) | |
tree | c5750b09e000f82e1dc7c8278e575aa3effeab0b /sinksh/sinksh_utils.cpp | |
parent | 684e3dfd401282674a2d28b7109f4f4abb83b62c (diff) | |
download | sink-50df30dfea10a3c1ee6fe8de9856fdb4596a08fe.tar.gz sink-50df30dfea10a3c1ee6fe8de9856fdb4596a08fe.zip |
Share the filter syntax for count and list
Diffstat (limited to 'sinksh/sinksh_utils.cpp')
-rw-r--r-- | sinksh/sinksh_utils.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/sinksh/sinksh_utils.cpp b/sinksh/sinksh_utils.cpp index 3a3484a..3fc9c29 100644 --- a/sinksh/sinksh_utils.cpp +++ b/sinksh/sinksh_utils.cpp | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include "common/store.h" | 23 | #include "common/store.h" |
24 | #include "common/log.h" | 24 | #include "common/log.h" |
25 | #include "common/propertyparser.h" | ||
25 | 26 | ||
26 | #include "utils.h" | 27 | #include "utils.h" |
27 | 28 | ||
@@ -195,7 +196,25 @@ bool applyFilter(Sink::Query &query, const QStringList &args_) | |||
195 | 196 | ||
196 | bool applyFilter(Sink::Query &query, const SyntaxTree::Options &options) | 197 | bool applyFilter(Sink::Query &query, const SyntaxTree::Options &options) |
197 | { | 198 | { |
198 | return applyFilter(query, options.positionalArguments); | 199 | bool ret = applyFilter(query, options.positionalArguments); |
200 | if (options.options.contains("resource")) { | ||
201 | for (const auto &f : options.options.value("resource")) { | ||
202 | query.resourceFilter(f.toLatin1()); | ||
203 | } | ||
204 | } | ||
205 | if (options.options.contains("filter")) { | ||
206 | for (const auto &f : options.options.value("filter")) { | ||
207 | auto filter = f.split("="); | ||
208 | const auto property = filter.value(0).toLatin1(); | ||
209 | query.filter(property, Sink::PropertyParser::parse(query.type(), property, filter.value(1))); | ||
210 | } | ||
211 | } | ||
212 | if (options.options.contains("id")) { | ||
213 | for (const auto &f : options.options.value("id")) { | ||
214 | query.filter(f.toUtf8()); | ||
215 | } | ||
216 | } | ||
217 | return ret; | ||
199 | } | 218 | } |
200 | 219 | ||
201 | } | 220 | } |