summaryrefslogtreecommitdiffstats
path: root/sinksh/syntax_modules/sink_count.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sinksh/syntax_modules/sink_count.cpp')
-rw-r--r--sinksh/syntax_modules/sink_count.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/sinksh/syntax_modules/sink_count.cpp b/sinksh/syntax_modules/sink_count.cpp
index aaa9c33..1edf1c2 100644
--- a/sinksh/syntax_modules/sink_count.cpp
+++ b/sinksh/syntax_modules/sink_count.cpp
@@ -37,21 +37,7 @@
37namespace SinkCount 37namespace SinkCount
38{ 38{
39 39
40bool count(const QStringList &args, State &state); 40Syntax::List syntax();
41
42Syntax::List syntax()
43{
44 Syntax count("count", QObject::tr("Returns the number of items of a given type in a resource"), &SinkCount::count, Syntax::EventDriven);
45
46 count.addPositionalArgument({.name = "type", .help = "The entity type to count"});
47 count.addPositionalArgument({.name = "resource", .help = "A resource id where to count", .required = false});
48
49 count.completer = &SinkshUtils::typeCompleter;
50
51 return Syntax::List() << count;
52}
53
54REGISTER_SYNTAX(SinkCount)
55 41
56bool count(const QStringList &args, State &state) 42bool count(const QStringList &args, State &state)
57{ 43{
@@ -77,4 +63,18 @@ bool count(const QStringList &args, State &state)
77 return true; 63 return true;
78} 64}
79 65
66Syntax::List syntax()
67{
68 Syntax count("count", QObject::tr("Returns the number of items of a given type in a resource"), &SinkCount::count, Syntax::EventDriven);
69
70 count.addPositionalArgument({.name = "type", .help = "The entity type to count"});
71 count.addPositionalArgument({.name = "resource", .help = "A resource id where to count", .required = false});
72
73 count.completer = &SinkshUtils::typeCompleter;
74
75 return Syntax::List() << count;
76}
77
78REGISTER_SYNTAX(SinkCount)
79
80} 80}