diff options
author | Minijackson <minijackson@riseup.net> | 2018-08-02 14:08:35 +0200 |
---|---|---|
committer | Minijackson <minijackson@riseup.net> | 2018-08-02 14:08:35 +0200 |
commit | c82c80d031d50e445bda7c02adbd3e97a635cde6 (patch) | |
tree | 7ac90aaa7c8ac9561dfd10d730052a38c07b01ee /sinksh/syntax_modules/sink_count.cpp | |
parent | 80c42b9707c7c44b7379734575c1b82fc97e95bf (diff) | |
download | sink-c82c80d031d50e445bda7c02adbd3e97a635cde6.tar.gz sink-c82c80d031d50e445bda7c02adbd3e97a635cde6.zip |
Put "syntax" at the bottomsinksh-better-cli
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 | } |