summaryrefslogtreecommitdiffstats
path: root/sinksh/syntax_modules/sink_livequery.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sinksh/syntax_modules/sink_livequery.cpp')
-rw-r--r--sinksh/syntax_modules/sink_livequery.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/sinksh/syntax_modules/sink_livequery.cpp b/sinksh/syntax_modules/sink_livequery.cpp
index e9e85ec..2d8d5d0 100644
--- a/sinksh/syntax_modules/sink_livequery.cpp
+++ b/sinksh/syntax_modules/sink_livequery.cpp
@@ -38,10 +38,12 @@
38namespace SinkLiveQuery 38namespace SinkLiveQuery
39{ 39{
40 40
41Syntax::List syntax();
42
41bool livequery(const QStringList &args_, State &state) 43bool livequery(const QStringList &args_, State &state)
42{ 44{
43 if (args_.isEmpty()) { 45 if (args_.isEmpty()) {
44 state.printError(QObject::tr("Options: $type [--resource $resource] [--compact] [--filter $property=$value] [--id $id] [--showall|--show $property]")); 46 state.printError(syntax()[0].usage());
45 return false; 47 return false;
46 } 48 }
47 49
@@ -55,7 +57,7 @@ bool livequery(const QStringList &args_, State &state)
55 query.setId("livequery"); 57 query.setId("livequery");
56 query.setFlags(Sink::Query::LiveQuery); 58 query.setFlags(Sink::Query::LiveQuery);
57 if (!SinkshUtils::applyFilter(query, options)) { 59 if (!SinkshUtils::applyFilter(query, options)) {
58 state.printError(QObject::tr("Options: $type [--resource $resource] [--compact] [--filter $property=$value] [--showall|--show $property]")); 60 state.printError(syntax()[0].usage());
59 return false; 61 return false;
60 } 62 }
61 if (options.options.contains("resource")) { 63 if (options.options.contains("resource")) {
@@ -124,6 +126,15 @@ bool livequery(const QStringList &args_, State &state)
124Syntax::List syntax() 126Syntax::List syntax()
125{ 127{
126 Syntax list("livequery", QObject::tr("Run a livequery."), &SinkLiveQuery::livequery, Syntax::EventDriven); 128 Syntax list("livequery", QObject::tr("Run a livequery."), &SinkLiveQuery::livequery, Syntax::EventDriven);
129
130 list.addPositionalArgument({ .name = "type", .help = "The type to run the livequery on" });
131 list.addParameter("resource", { .name = "resource", .help = "Filter the livequery to the given resource" });
132 list.addFlag("compact", "Use a compact view (reduces the size of IDs)");
133 list.addParameter("filter", { .name = "property=$value", .help = "Filter the results" });
134 list.addParameter("id", { .name = "id", .help = "List only the content with the given ID" });
135 list.addFlag("showall", "Show all properties");
136 list.addParameter("show", { .name = "property", .help = "Only show the given property" });
137
127 list.completer = &SinkshUtils::resourceOrTypeCompleter; 138 list.completer = &SinkshUtils::resourceOrTypeCompleter;
128 return Syntax::List() << list; 139 return Syntax::List() << list;
129} 140}