diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-05-09 09:48:07 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-05-09 09:48:07 +0200 |
commit | 13560f13b1f3d204efc52944f0aaadbad5567d06 (patch) | |
tree | ef54797b117339ba052fa5d8c149159bb3c6c387 /sinksh | |
parent | 5162328cd8edba85017185ef5864b2b65f6f18ed (diff) | |
download | sink-13560f13b1f3d204efc52944f0aaadbad5567d06.tar.gz sink-13560f13b1f3d204efc52944f0aaadbad5567d06.zip |
Property filter for list
Diffstat (limited to 'sinksh')
-rw-r--r-- | sinksh/syntax_modules/sink_list.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/sinksh/syntax_modules/sink_list.cpp b/sinksh/syntax_modules/sink_list.cpp index cb71ce4..b85de97 100644 --- a/sinksh/syntax_modules/sink_list.cpp +++ b/sinksh/syntax_modules/sink_list.cpp | |||
@@ -46,8 +46,7 @@ bool list(const QStringList &args, State &state) | |||
46 | return false; | 46 | return false; |
47 | } | 47 | } |
48 | 48 | ||
49 | auto resources = args; | 49 | auto type = !args.isEmpty() ? args.at(0) : QString(); |
50 | auto type = !resources.isEmpty() ? resources.takeFirst() : QString(); | ||
51 | 50 | ||
52 | if (!type.isEmpty() && !SinkshUtils::isValidStoreType(type)) { | 51 | if (!type.isEmpty() && !SinkshUtils::isValidStoreType(type)) { |
53 | state.printError(QObject::tr("Unknown type: %1").arg(type)); | 52 | state.printError(QObject::tr("Unknown type: %1").arg(type)); |
@@ -55,9 +54,20 @@ bool list(const QStringList &args, State &state) | |||
55 | } | 54 | } |
56 | 55 | ||
57 | Sink::Query query; | 56 | Sink::Query query; |
58 | for (const auto &res : resources) { | 57 | |
59 | query.resources << res.toLatin1(); | 58 | auto filterIndex = args.indexOf("--filter"); |
59 | if (filterIndex >= 0) { | ||
60 | for (int i = 1; i < filterIndex; i++) { | ||
61 | query.resources << args.at(i).toLatin1(); | ||
62 | query += Sink::Query::ResourceFilter(args.at(i).toLatin1()); | ||
63 | } | ||
64 | for (int i = filterIndex + 1; i < args.size(); i++) { | ||
65 | auto filter = args.at(i).split("="); | ||
66 | query += Sink::Query::PropertyFilter(filter.at(0).toLatin1(), filter.at(1)); | ||
67 | } | ||
68 | |||
60 | } | 69 | } |
70 | |||
61 | query.liveQuery = false; | 71 | query.liveQuery = false; |
62 | 72 | ||
63 | QTime time; | 73 | QTime time; |