From c82c80d031d50e445bda7c02adbd3e97a635cde6 Mon Sep 17 00:00:00 2001 From: Minijackson Date: Thu, 2 Aug 2018 14:08:35 +0200 Subject: Put "syntax" at the bottom --- sinksh/syntax_modules/sink_create.cpp | 73 +++++++++++++++++------------------ 1 file changed, 35 insertions(+), 38 deletions(-) (limited to 'sinksh/syntax_modules/sink_create.cpp') 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; namespace SinkCreate { -bool create(const QStringList &allArgs, State &state); -bool resource(const QStringList &args, State &state); -bool account(const QStringList &args, State &state); -bool identity(const QStringList &args, State &state); - -Syntax::List syntax() -{ - Syntax::List syntax; - - Syntax create("create", QObject::tr("Create items in a resource"), &SinkCreate::create); - create.addPositionalArgument({ .name = "type", .help = "The type of entity to create (mail, event, etc.)" }); - create.addPositionalArgument({ .name = "resourceId", .help = "The ID of the resource that will contain the new entity" }); - create.addPositionalArgument( - { .name = "key value", .help = "Content of the entity", .required = false, .variadic = true }); - - Syntax resource("resource", QObject::tr("Creates a new resource"), &SinkCreate::resource); - resource.addPositionalArgument({ .name = "type", .help = "The type of resource to create" }); - resource.addPositionalArgument( - { .name = "key value", .help = "Content of the resource", .required = false, .variadic = true }); - - Syntax account("account", QObject::tr("Creates a new account"), &SinkCreate::account); - account.addPositionalArgument({ .name = "type", .help = "The type of account to create" }); - account.addPositionalArgument( - { .name = "key value", .help = "Content of the account", .required = false, .variadic = true }); - - Syntax identity("identity", QObject::tr("Creates a new identity"), &SinkCreate::identity); - identity.addPositionalArgument( - { .name = "key value", .help = "Content of the identity", .required = false, .variadic = true }); - - create.children << resource; - create.children << account; - create.children << identity; - - syntax << create; - return syntax; -} - -REGISTER_SYNTAX(SinkCreate) +Syntax::List syntax(); bool create(const QStringList &allArgs, State &state) { @@ -207,4 +170,38 @@ bool identity(const QStringList &args, State &state) return true; } +Syntax::List syntax() +{ + Syntax::List syntax; + + Syntax create("create", QObject::tr("Create items in a resource"), &SinkCreate::create); + create.addPositionalArgument({ .name = "type", .help = "The type of entity to create (mail, event, etc.)" }); + create.addPositionalArgument({ .name = "resourceId", .help = "The ID of the resource that will contain the new entity" }); + create.addPositionalArgument( + { .name = "key value", .help = "Content of the entity", .required = false, .variadic = true }); + + Syntax resource("resource", QObject::tr("Creates a new resource"), &SinkCreate::resource); + resource.addPositionalArgument({ .name = "type", .help = "The type of resource to create" }); + resource.addPositionalArgument( + { .name = "key value", .help = "Content of the resource", .required = false, .variadic = true }); + + Syntax account("account", QObject::tr("Creates a new account"), &SinkCreate::account); + account.addPositionalArgument({ .name = "type", .help = "The type of account to create" }); + account.addPositionalArgument( + { .name = "key value", .help = "Content of the account", .required = false, .variadic = true }); + + Syntax identity("identity", QObject::tr("Creates a new identity"), &SinkCreate::identity); + identity.addPositionalArgument( + { .name = "key value", .help = "Content of the identity", .required = false, .variadic = true }); + + create.children << resource; + create.children << account; + create.children << identity; + + syntax << create; + return syntax; +} + +REGISTER_SYNTAX(SinkCreate) + } -- cgit v1.2.3