diff options
Diffstat (limited to 'sinksh/syntax_modules/sink_count.cpp')
-rw-r--r-- | sinksh/syntax_modules/sink_count.cpp | 30 |
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 @@ | |||
37 | namespace SinkCount | 37 | namespace SinkCount |
38 | { | 38 | { |
39 | 39 | ||
40 | bool count(const QStringList &args, State &state); | 40 | Syntax::List syntax(); |
41 | |||
42 | Syntax::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 | |||
54 | REGISTER_SYNTAX(SinkCount) | ||
55 | 41 | ||
56 | bool count(const QStringList &args, State &state) | 42 | bool 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 | ||
66 | Syntax::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 | |||
78 | REGISTER_SYNTAX(SinkCount) | ||
79 | |||
80 | } | 80 | } |