From 256b5beb89d2c67d74d80a6f1a0f0dad074911e3 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Fri, 3 Aug 2018 22:43:54 +0200 Subject: Removed the use of C99 extensions --- sinksh/syntax_modules/sink_clear.cpp | 5 +---- sinksh/syntax_modules/sink_count.cpp | 7 ++----- sinksh/syntax_modules/sink_create.cpp | 20 ++++++++------------ sinksh/syntax_modules/sink_drop.cpp | 2 +- sinksh/syntax_modules/sink_inspect.cpp | 15 +++++---------- sinksh/syntax_modules/sink_list.cpp | 16 ++++++++-------- sinksh/syntax_modules/sink_livequery.cpp | 10 +++++----- sinksh/syntax_modules/sink_modify.cpp | 14 ++++++-------- sinksh/syntax_modules/sink_remove.cpp | 13 ++++++------- sinksh/syntax_modules/sink_stat.cpp | 12 ++---------- sinksh/syntax_modules/sink_sync.cpp | 6 +++--- 11 files changed, 47 insertions(+), 73 deletions(-) diff --git a/sinksh/syntax_modules/sink_clear.cpp b/sinksh/syntax_modules/sink_clear.cpp index ca38943..4be6056 100644 --- a/sinksh/syntax_modules/sink_clear.cpp +++ b/sinksh/syntax_modules/sink_clear.cpp @@ -55,11 +55,8 @@ bool clear(const QStringList &args, State &state) Syntax::List syntax() { Syntax clear("clear", QObject::tr("Clears the local cache of one or more resources (be careful!)"), &SinkClear::clear, Syntax::NotInteractive); - - clear.addPositionalArgument({.name = "resource", .help = "The resource to clear"}); - + clear.addPositionalArgument({"resource", "The resource to clear"}); clear.completer = &SinkshUtils::resourceCompleter; - return Syntax::List() << clear; } diff --git a/sinksh/syntax_modules/sink_count.cpp b/sinksh/syntax_modules/sink_count.cpp index 1edf1c2..f16b92b 100644 --- a/sinksh/syntax_modules/sink_count.cpp +++ b/sinksh/syntax_modules/sink_count.cpp @@ -66,12 +66,9 @@ bool count(const QStringList &args, State &state) Syntax::List syntax() { Syntax count("count", QObject::tr("Returns the number of items of a given type in a resource"), &SinkCount::count, Syntax::EventDriven); - - count.addPositionalArgument({.name = "type", .help = "The entity type to count"}); - count.addPositionalArgument({.name = "resource", .help = "A resource id where to count", .required = false}); - + count.addPositionalArgument({"type", "The entity type to count"}); + count.addPositionalArgument({"resource", "A resource id where to count", false}); count.completer = &SinkshUtils::typeCompleter; - return Syntax::List() << count; } diff --git a/sinksh/syntax_modules/sink_create.cpp b/sinksh/syntax_modules/sink_create.cpp index b1631cd..f9b2c6b 100644 --- a/sinksh/syntax_modules/sink_create.cpp +++ b/sinksh/syntax_modules/sink_create.cpp @@ -175,24 +175,20 @@ 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 }); + create.addPositionalArgument({"type", "The type of entity to create (mail, event, etc.)"}); + create.addPositionalArgument({"resourceId", "The ID of the resource that will contain the new entity"}); + create.addPositionalArgument({"key value", "Content of the entity", false, 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 }); + resource.addPositionalArgument({"type", "The type of resource to create" }); + resource.addPositionalArgument({"key value", "Content of the resource", false, 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 }); + account.addPositionalArgument({"type", "The type of account to create" }); + account.addPositionalArgument({"key value", "Content of the account", false, 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 }); + identity.addPositionalArgument({"key value", "Content of the identity", false, true}); create.children << resource; create.children << account; diff --git a/sinksh/syntax_modules/sink_drop.cpp b/sinksh/syntax_modules/sink_drop.cpp index eaa3041..e4bc92b 100644 --- a/sinksh/syntax_modules/sink_drop.cpp +++ b/sinksh/syntax_modules/sink_drop.cpp @@ -62,7 +62,7 @@ bool drop(const QStringList &args, State &state) Syntax::List syntax() { Syntax drop("drop", QObject::tr("Drop all caches of a resource."), &SinkDrop::drop, Syntax::NotInteractive); - drop.addPositionalArgument({.name = "resource", .help = "Id(s) of the resource(s) to drop", .required = true, .variadic = true}); + drop.addPositionalArgument({"resource", "Id(s) of the resource(s) to drop", true, true}); drop.completer = &SinkshUtils::resourceOrTypeCompleter; return Syntax::List() << drop; diff --git a/sinksh/syntax_modules/sink_inspect.cpp b/sinksh/syntax_modules/sink_inspect.cpp index 355efa3..1d2d90f 100644 --- a/sinksh/syntax_modules/sink_inspect.cpp +++ b/sinksh/syntax_modules/sink_inspect.cpp @@ -243,17 +243,12 @@ Syntax::List syntax() Syntax state("inspect", QObject::tr("Inspect database for the resource requested"), &SinkInspect::inspect, Syntax::NotInteractive); - state.addParameter("resource", - { .name = "resource", .help = "Which resource to inspect", .required = true }); - state.addParameter("db", - { .name = "database", .help = "Which database to inspect"}); - state.addParameter("filter", - { .name = "id", .help = "A specific id to filter the results by (currently not working)"}); + state.addParameter("resource", {"resource", "Which resource to inspect", true}); + state.addParameter("db", {"database", "Which database to inspect"}); + state.addParameter("filter", {"id", "A specific id to filter the results by (currently not working)"}); state.addFlag("showinternal", "Show internal fields only"); - state.addParameter("validaterids", - { .name = "type", .help = "Validate remote Ids of the given type"}); - state.addParameter("fulltext", - { .name = "id", .help = "If 'id' is not given, count the number of fulltext documents. Else, print the terms of the document with the given id"}); + state.addParameter("validaterids", {"type", "Validate remote Ids of the given type"}); + state.addParameter("fulltext", {"id", "If 'id' is not given, count the number of fulltext documents. Else, print the terms of the document with the given id"}); state.completer = &SinkshUtils::resourceCompleter; diff --git a/sinksh/syntax_modules/sink_list.cpp b/sinksh/syntax_modules/sink_list.cpp index eef188b..36b1847 100644 --- a/sinksh/syntax_modules/sink_list.cpp +++ b/sinksh/syntax_modules/sink_list.cpp @@ -201,16 +201,16 @@ Syntax::List syntax() { Syntax list("list", QObject::tr("List all resources, or the contents of one or more resources."), &SinkList::list, Syntax::NotInteractive); - list.addPositionalArgument({.name = "type", .help = "The type of content to list (resource, identity, account, mail, etc.)"}); - list.addParameter("resource", { .name = "resource", .help = "List only the content of the given resource" }); + list.addPositionalArgument({"type", "The type of content to list (resource, identity, account, mail, etc.)"}); + list.addParameter("resource", {"resource", "List only the content of the given resource" }); list.addFlag("compact", "Use a compact view (reduces the size of IDs)"); - list.addParameter("filter", { .name = "property=$value", .help = "Filter the results" }); - list.addParameter("id", { .name = "id", .help = "List only the content with the given ID" }); + list.addParameter("filter", {"property=$value", "Filter the results" }); + list.addParameter("id", {"id", "List only the content with the given ID" }); list.addFlag("showall", "Show all properties"); - list.addParameter("show", { .name = "property", .help = "Only show the given property" }); - list.addParameter("reduce", { .name = "property:$selectorProperty", .help = "Combine the result with the same $property, sorted by $selectorProperty" }); - list.addParameter("sort", { .name = "property", .help = "Sort the results according to the given property" }); - list.addParameter("limit", { .name = "count", .help = "Limit the results" }); + list.addParameter("show", {"property", "Only show the given property" }); + list.addParameter("reduce", {"property:$selectorProperty", "Combine the result with the same $property, sorted by $selectorProperty" }); + list.addParameter("sort", {"property", "Sort the results according to the given property" }); + list.addParameter("limit", {"count", "Limit the results" }); list.completer = &SinkshUtils::resourceOrTypeCompleter; return Syntax::List() << list; diff --git a/sinksh/syntax_modules/sink_livequery.cpp b/sinksh/syntax_modules/sink_livequery.cpp index 2d8d5d0..42d7d33 100644 --- a/sinksh/syntax_modules/sink_livequery.cpp +++ b/sinksh/syntax_modules/sink_livequery.cpp @@ -127,13 +127,13 @@ Syntax::List syntax() { Syntax list("livequery", QObject::tr("Run a livequery."), &SinkLiveQuery::livequery, Syntax::EventDriven); - list.addPositionalArgument({ .name = "type", .help = "The type to run the livequery on" }); - list.addParameter("resource", { .name = "resource", .help = "Filter the livequery to the given resource" }); + list.addPositionalArgument({"type", "The type to run the livequery on" }); + list.addParameter("resource", {"resource", "Filter the livequery to the given resource" }); list.addFlag("compact", "Use a compact view (reduces the size of IDs)"); - list.addParameter("filter", { .name = "property=$value", .help = "Filter the results" }); - list.addParameter("id", { .name = "id", .help = "List only the content with the given ID" }); + list.addParameter("filter", {"property=$value", "Filter the results" }); + list.addParameter("id", {"id", "List only the content with the given ID" }); list.addFlag("showall", "Show all properties"); - list.addParameter("show", { .name = "property", .help = "Only show the given property" }); + list.addParameter("show", {"property", "Only show the given property" }); list.completer = &SinkshUtils::resourceOrTypeCompleter; return Syntax::List() << list; diff --git a/sinksh/syntax_modules/sink_modify.cpp b/sinksh/syntax_modules/sink_modify.cpp index 6cda5ab..173d65e 100644 --- a/sinksh/syntax_modules/sink_modify.cpp +++ b/sinksh/syntax_modules/sink_modify.cpp @@ -101,17 +101,15 @@ bool resource(const QStringList &args, State &state) Syntax::List syntax() { Syntax modify("modify", QObject::tr("Modify items in a resource"), &SinkModify::modify); - modify.addPositionalArgument({ .name = "type", .help = "The type of entity to modify (mail, event, etc.)" }); - modify.addPositionalArgument({ .name = "resourceId", .help = "The ID of the resource containing the entity" }); - modify.addPositionalArgument({ .name = "objectId", .help = "The ID of the entity" }); - modify.addPositionalArgument( - { .name = "key value", .help = "Attributes and values to modify", .required = false, .variadic = true }); + modify.addPositionalArgument({"type", "The type of entity to modify (mail, event, etc.)"}); + modify.addPositionalArgument({"resourceId", "The ID of the resource containing the entity"}); + modify.addPositionalArgument({"objectId", "The ID of the entity"}); + modify.addPositionalArgument({"key value", "Attributes and values to modify", false, true }); Syntax resource("resource", QObject::tr("Modify a resource"), &SinkModify::resource);//, Syntax::EventDriven); - resource.addPositionalArgument({ .name = "id", .help = "The ID of the resource" }); - resource.addPositionalArgument( - { .name = "key value", .help = "Attributes and values to modify", .required = false, .variadic = true }); + resource.addPositionalArgument({"id", "The ID of the resource" }); + resource.addPositionalArgument({"key value", "Attributes and values to modify", false, true}); resource.completer = &SinkshUtils::resourceOrTypeCompleter; modify.children << resource; diff --git a/sinksh/syntax_modules/sink_remove.cpp b/sinksh/syntax_modules/sink_remove.cpp index 999a889..39b3d60 100644 --- a/sinksh/syntax_modules/sink_remove.cpp +++ b/sinksh/syntax_modules/sink_remove.cpp @@ -132,20 +132,19 @@ bool identity(const QStringList &args, State &state) Syntax::List syntax() { Syntax remove("remove", QObject::tr("Remove items in a resource"), &SinkRemove::remove); - - remove.addPositionalArgument({ .name = "type", .help = "The type of entity to remove (mail, event, etc.)" }); - remove.addPositionalArgument({ .name = "resourceId", .help = "The ID of the resource containing the entity" }); - remove.addPositionalArgument({ .name = "objectId", .help = "The ID of the entity to remove" }); + remove.addPositionalArgument({"type", "The type of entity to remove (mail, event, etc.)"}); + remove.addPositionalArgument({"resourceId", "The ID of the resource containing the entity"}); + remove.addPositionalArgument({"objectId", "The ID of the entity to remove"}); Syntax resource("resource", QObject::tr("Removes a resource"), &SinkRemove::resource, Syntax::NotInteractive); - resource.addPositionalArgument({ .name = "id", .help = "The ID of the resource to remove" }); + resource.addPositionalArgument({"id", "The ID of the resource to remove"}); resource.completer = &SinkshUtils::resourceCompleter; Syntax account("account", QObject::tr("Removes a account"), &SinkRemove::account, Syntax::NotInteractive); - account.addPositionalArgument({ .name = "id", .help = "The ID of the account to remove" }); + account.addPositionalArgument({"id", "The ID of the account to remove"}); Syntax identity("identity", QObject::tr("Removes an identity"), &SinkRemove::identity, Syntax::NotInteractive); - identity.addPositionalArgument({ .name = "id", .help = "The ID of the account to remove" }); + identity.addPositionalArgument({"id", "The ID of the account to remove"}); remove.children << resource << account << identity; diff --git a/sinksh/syntax_modules/sink_stat.cpp b/sinksh/syntax_modules/sink_stat.cpp index a936af2..202d1ce 100644 --- a/sinksh/syntax_modules/sink_stat.cpp +++ b/sinksh/syntax_modules/sink_stat.cpp @@ -101,17 +101,9 @@ bool stat(const QStringList &args, State &state) Syntax::List syntax() { - Syntax state("stat", QObject::tr("Shows database usage for the resources requested"), - &SinkStat::stat, Syntax::NotInteractive); - - state.addPositionalArgument({ .name = "resourceId", - .help = "Show statistics of the given resource(s). If no resource is provided, show " - "statistics of all resources", - .required = false, - .variadic = true }); - + Syntax state("stat", QObject::tr("Shows database usage for the resources requested"), &SinkStat::stat, Syntax::NotInteractive); + state.addPositionalArgument({"resourceId", "Show statistics of the given resource(s). If no resource is provided, show statistics of all resources", false, true}); state.completer = &SinkshUtils::resourceCompleter; - return Syntax::List() << state; } diff --git a/sinksh/syntax_modules/sink_sync.cpp b/sinksh/syntax_modules/sink_sync.cpp index e13e8f8..8126bd2 100644 --- a/sinksh/syntax_modules/sink_sync.cpp +++ b/sinksh/syntax_modules/sink_sync.cpp @@ -84,9 +84,9 @@ Syntax::List syntax() { Syntax sync("sync", QObject::tr("Synchronizes a resource."), &SinkSync::sync, Syntax::EventDriven); - sync.addPositionalArgument({ .name = "type", .help = "The type of resource to synchronize" }); - sync.addPositionalArgument({ .name = "resourceId", .help = "The ID of the resource to synchronize" }); - sync.addParameter("password", { .name = "password", .help = "The password of the resource", .required = true }); + sync.addPositionalArgument({"type", "The type of resource to synchronize"}); + sync.addPositionalArgument({"resourceId", "The ID of the resource to synchronize"}); + sync.addParameter("password", {"password", "The password of the resource", true}); sync.completer = &SinkshUtils::resourceCompleter; -- cgit v1.2.3