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_create.cpp | |
parent | 80c42b9707c7c44b7379734575c1b82fc97e95bf (diff) | |
download | sinksh-better-cli.tar.gz sinksh-better-cli.zip |
Put "syntax" at the bottomsinksh-better-cli
Diffstat (limited to 'sinksh/syntax_modules/sink_create.cpp')
-rw-r--r-- | sinksh/syntax_modules/sink_create.cpp | 73 |
1 files changed, 35 insertions, 38 deletions
diff --git a/sinksh/syntax_modules/sink_create.cpp b/sinksh/syntax_modules/sink_create.cpp index b7025cc..b1631cd 100644 --- a/sinksh/syntax_modules/sink_create.cpp +++ b/sinksh/syntax_modules/sink_create.cpp | |||
@@ -40,44 +40,7 @@ using namespace Sink; | |||
40 | namespace SinkCreate | 40 | namespace SinkCreate |
41 | { | 41 | { |
42 | 42 | ||
43 | bool create(const QStringList &allArgs, State &state); | 43 | Syntax::List syntax(); |
44 | bool resource(const QStringList &args, State &state); | ||
45 | bool account(const QStringList &args, State &state); | ||
46 | bool identity(const QStringList &args, State &state); | ||
47 | |||
48 | Syntax::List syntax() | ||
49 | { | ||
50 | Syntax::List syntax; | ||
51 | |||
52 | Syntax create("create", QObject::tr("Create items in a resource"), &SinkCreate::create); | ||
53 | create.addPositionalArgument({ .name = "type", .help = "The type of entity to create (mail, event, etc.)" }); | ||
54 | create.addPositionalArgument({ .name = "resourceId", .help = "The ID of the resource that will contain the new entity" }); | ||
55 | create.addPositionalArgument( | ||
56 | { .name = "key value", .help = "Content of the entity", .required = false, .variadic = true }); | ||
57 | |||
58 | Syntax resource("resource", QObject::tr("Creates a new resource"), &SinkCreate::resource); | ||
59 | resource.addPositionalArgument({ .name = "type", .help = "The type of resource to create" }); | ||
60 | resource.addPositionalArgument( | ||
61 | { .name = "key value", .help = "Content of the resource", .required = false, .variadic = true }); | ||
62 | |||
63 | Syntax account("account", QObject::tr("Creates a new account"), &SinkCreate::account); | ||
64 | account.addPositionalArgument({ .name = "type", .help = "The type of account to create" }); | ||
65 | account.addPositionalArgument( | ||
66 | { .name = "key value", .help = "Content of the account", .required = false, .variadic = true }); | ||
67 | |||
68 | Syntax identity("identity", QObject::tr("Creates a new identity"), &SinkCreate::identity); | ||
69 | identity.addPositionalArgument( | ||
70 | { .name = "key value", .help = "Content of the identity", .required = false, .variadic = true }); | ||
71 | |||
72 | create.children << resource; | ||
73 | create.children << account; | ||
74 | create.children << identity; | ||
75 | |||
76 | syntax << create; | ||
77 | return syntax; | ||
78 | } | ||
79 | |||
80 | REGISTER_SYNTAX(SinkCreate) | ||
81 | 44 | ||
82 | bool create(const QStringList &allArgs, State &state) | 45 | bool create(const QStringList &allArgs, State &state) |
83 | { | 46 | { |
@@ -207,4 +170,38 @@ bool identity(const QStringList &args, State &state) | |||
207 | return true; | 170 | return true; |
208 | } | 171 | } |
209 | 172 | ||
173 | Syntax::List syntax() | ||
174 | { | ||
175 | Syntax::List syntax; | ||
176 | |||
177 | Syntax create("create", QObject::tr("Create items in a resource"), &SinkCreate::create); | ||
178 | create.addPositionalArgument({ .name = "type", .help = "The type of entity to create (mail, event, etc.)" }); | ||
179 | create.addPositionalArgument({ .name = "resourceId", .help = "The ID of the resource that will contain the new entity" }); | ||
180 | create.addPositionalArgument( | ||
181 | { .name = "key value", .help = "Content of the entity", .required = false, .variadic = true }); | ||
182 | |||
183 | Syntax resource("resource", QObject::tr("Creates a new resource"), &SinkCreate::resource); | ||
184 | resource.addPositionalArgument({ .name = "type", .help = "The type of resource to create" }); | ||
185 | resource.addPositionalArgument( | ||
186 | { .name = "key value", .help = "Content of the resource", .required = false, .variadic = true }); | ||
187 | |||
188 | Syntax account("account", QObject::tr("Creates a new account"), &SinkCreate::account); | ||
189 | account.addPositionalArgument({ .name = "type", .help = "The type of account to create" }); | ||
190 | account.addPositionalArgument( | ||
191 | { .name = "key value", .help = "Content of the account", .required = false, .variadic = true }); | ||
192 | |||
193 | Syntax identity("identity", QObject::tr("Creates a new identity"), &SinkCreate::identity); | ||
194 | identity.addPositionalArgument( | ||
195 | { .name = "key value", .help = "Content of the identity", .required = false, .variadic = true }); | ||
196 | |||
197 | create.children << resource; | ||
198 | create.children << account; | ||
199 | create.children << identity; | ||
200 | |||
201 | syntax << create; | ||
202 | return syntax; | ||
203 | } | ||
204 | |||
205 | REGISTER_SYNTAX(SinkCreate) | ||
206 | |||
210 | } | 207 | } |