summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2018-08-03 22:43:54 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2018-08-03 22:43:54 +0200
commit256b5beb89d2c67d74d80a6f1a0f0dad074911e3 (patch)
tree23326dfe10e290417f823803c75628327f727636
parent50bed81038f10091d35c5719df8078612393ae95 (diff)
downloadsink-256b5beb89d2c67d74d80a6f1a0f0dad074911e3.tar.gz
sink-256b5beb89d2c67d74d80a6f1a0f0dad074911e3.zip
Removed the use of C99 extensions
-rw-r--r--sinksh/syntax_modules/sink_clear.cpp5
-rw-r--r--sinksh/syntax_modules/sink_count.cpp7
-rw-r--r--sinksh/syntax_modules/sink_create.cpp20
-rw-r--r--sinksh/syntax_modules/sink_drop.cpp2
-rw-r--r--sinksh/syntax_modules/sink_inspect.cpp15
-rw-r--r--sinksh/syntax_modules/sink_list.cpp16
-rw-r--r--sinksh/syntax_modules/sink_livequery.cpp10
-rw-r--r--sinksh/syntax_modules/sink_modify.cpp14
-rw-r--r--sinksh/syntax_modules/sink_remove.cpp13
-rw-r--r--sinksh/syntax_modules/sink_stat.cpp12
-rw-r--r--sinksh/syntax_modules/sink_sync.cpp6
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)
55Syntax::List syntax() 55Syntax::List syntax()
56{ 56{
57 Syntax clear("clear", QObject::tr("Clears the local cache of one or more resources (be careful!)"), &SinkClear::clear, Syntax::NotInteractive); 57 Syntax clear("clear", QObject::tr("Clears the local cache of one or more resources (be careful!)"), &SinkClear::clear, Syntax::NotInteractive);
58 58 clear.addPositionalArgument({"resource", "The resource to clear"});
59 clear.addPositionalArgument({.name = "resource", .help = "The resource to clear"});
60
61 clear.completer = &SinkshUtils::resourceCompleter; 59 clear.completer = &SinkshUtils::resourceCompleter;
62
63 return Syntax::List() << clear; 60 return Syntax::List() << clear;
64} 61}
65 62
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)
66Syntax::List syntax() 66Syntax::List syntax()
67{ 67{
68 Syntax count("count", QObject::tr("Returns the number of items of a given type in a resource"), &SinkCount::count, Syntax::EventDriven); 68 Syntax count("count", QObject::tr("Returns the number of items of a given type in a resource"), &SinkCount::count, Syntax::EventDriven);
69 69 count.addPositionalArgument({"type", "The entity type to count"});
70 count.addPositionalArgument({.name = "type", .help = "The entity type to count"}); 70 count.addPositionalArgument({"resource", "A resource id where to count", false});
71 count.addPositionalArgument({.name = "resource", .help = "A resource id where to count", .required = false});
72
73 count.completer = &SinkshUtils::typeCompleter; 71 count.completer = &SinkshUtils::typeCompleter;
74
75 return Syntax::List() << count; 72 return Syntax::List() << count;
76} 73}
77 74
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()
175 Syntax::List syntax; 175 Syntax::List syntax;
176 176
177 Syntax create("create", QObject::tr("Create items in a resource"), &SinkCreate::create); 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.)" }); 178 create.addPositionalArgument({"type", "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" }); 179 create.addPositionalArgument({"resourceId", "The ID of the resource that will contain the new entity"});
180 create.addPositionalArgument( 180 create.addPositionalArgument({"key value", "Content of the entity", false, true});
181 { .name = "key value", .help = "Content of the entity", .required = false, .variadic = true });
182 181
183 Syntax resource("resource", QObject::tr("Creates a new resource"), &SinkCreate::resource); 182 Syntax resource("resource", QObject::tr("Creates a new resource"), &SinkCreate::resource);
184 resource.addPositionalArgument({ .name = "type", .help = "The type of resource to create" }); 183 resource.addPositionalArgument({"type", "The type of resource to create" });
185 resource.addPositionalArgument( 184 resource.addPositionalArgument({"key value", "Content of the resource", false, true});
186 { .name = "key value", .help = "Content of the resource", .required = false, .variadic = true });
187 185
188 Syntax account("account", QObject::tr("Creates a new account"), &SinkCreate::account); 186 Syntax account("account", QObject::tr("Creates a new account"), &SinkCreate::account);
189 account.addPositionalArgument({ .name = "type", .help = "The type of account to create" }); 187 account.addPositionalArgument({"type", "The type of account to create" });
190 account.addPositionalArgument( 188 account.addPositionalArgument({"key value", "Content of the account", false, true});
191 { .name = "key value", .help = "Content of the account", .required = false, .variadic = true });
192 189
193 Syntax identity("identity", QObject::tr("Creates a new identity"), &SinkCreate::identity); 190 Syntax identity("identity", QObject::tr("Creates a new identity"), &SinkCreate::identity);
194 identity.addPositionalArgument( 191 identity.addPositionalArgument({"key value", "Content of the identity", false, true});
195 { .name = "key value", .help = "Content of the identity", .required = false, .variadic = true });
196 192
197 create.children << resource; 193 create.children << resource;
198 create.children << account; 194 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)
62Syntax::List syntax() 62Syntax::List syntax()
63{ 63{
64 Syntax drop("drop", QObject::tr("Drop all caches of a resource."), &SinkDrop::drop, Syntax::NotInteractive); 64 Syntax drop("drop", QObject::tr("Drop all caches of a resource."), &SinkDrop::drop, Syntax::NotInteractive);
65 drop.addPositionalArgument({.name = "resource", .help = "Id(s) of the resource(s) to drop", .required = true, .variadic = true}); 65 drop.addPositionalArgument({"resource", "Id(s) of the resource(s) to drop", true, true});
66 66
67 drop.completer = &SinkshUtils::resourceOrTypeCompleter; 67 drop.completer = &SinkshUtils::resourceOrTypeCompleter;
68 return Syntax::List() << drop; 68 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()
243 Syntax state("inspect", QObject::tr("Inspect database for the resource requested"), 243 Syntax state("inspect", QObject::tr("Inspect database for the resource requested"),
244 &SinkInspect::inspect, Syntax::NotInteractive); 244 &SinkInspect::inspect, Syntax::NotInteractive);
245 245
246 state.addParameter("resource", 246 state.addParameter("resource", {"resource", "Which resource to inspect", true});
247 { .name = "resource", .help = "Which resource to inspect", .required = true }); 247 state.addParameter("db", {"database", "Which database to inspect"});
248 state.addParameter("db", 248 state.addParameter("filter", {"id", "A specific id to filter the results by (currently not working)"});
249 { .name = "database", .help = "Which database to inspect"});
250 state.addParameter("filter",
251 { .name = "id", .help = "A specific id to filter the results by (currently not working)"});
252 state.addFlag("showinternal", "Show internal fields only"); 249 state.addFlag("showinternal", "Show internal fields only");
253 state.addParameter("validaterids", 250 state.addParameter("validaterids", {"type", "Validate remote Ids of the given type"});
254 { .name = "type", .help = "Validate remote Ids of the given type"}); 251 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"});
255 state.addParameter("fulltext",
256 { .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"});
257 252
258 state.completer = &SinkshUtils::resourceCompleter; 253 state.completer = &SinkshUtils::resourceCompleter;
259 254
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()
201{ 201{
202 Syntax list("list", QObject::tr("List all resources, or the contents of one or more resources."), &SinkList::list, Syntax::NotInteractive); 202 Syntax list("list", QObject::tr("List all resources, or the contents of one or more resources."), &SinkList::list, Syntax::NotInteractive);
203 203
204 list.addPositionalArgument({.name = "type", .help = "The type of content to list (resource, identity, account, mail, etc.)"}); 204 list.addPositionalArgument({"type", "The type of content to list (resource, identity, account, mail, etc.)"});
205 list.addParameter("resource", { .name = "resource", .help = "List only the content of the given resource" }); 205 list.addParameter("resource", {"resource", "List only the content of the given resource" });
206 list.addFlag("compact", "Use a compact view (reduces the size of IDs)"); 206 list.addFlag("compact", "Use a compact view (reduces the size of IDs)");
207 list.addParameter("filter", { .name = "property=$value", .help = "Filter the results" }); 207 list.addParameter("filter", {"property=$value", "Filter the results" });
208 list.addParameter("id", { .name = "id", .help = "List only the content with the given ID" }); 208 list.addParameter("id", {"id", "List only the content with the given ID" });
209 list.addFlag("showall", "Show all properties"); 209 list.addFlag("showall", "Show all properties");
210 list.addParameter("show", { .name = "property", .help = "Only show the given property" }); 210 list.addParameter("show", {"property", "Only show the given property" });
211 list.addParameter("reduce", { .name = "property:$selectorProperty", .help = "Combine the result with the same $property, sorted by $selectorProperty" }); 211 list.addParameter("reduce", {"property:$selectorProperty", "Combine the result with the same $property, sorted by $selectorProperty" });
212 list.addParameter("sort", { .name = "property", .help = "Sort the results according to the given property" }); 212 list.addParameter("sort", {"property", "Sort the results according to the given property" });
213 list.addParameter("limit", { .name = "count", .help = "Limit the results" }); 213 list.addParameter("limit", {"count", "Limit the results" });
214 214
215 list.completer = &SinkshUtils::resourceOrTypeCompleter; 215 list.completer = &SinkshUtils::resourceOrTypeCompleter;
216 return Syntax::List() << list; 216 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()
127{ 127{
128 Syntax list("livequery", QObject::tr("Run a livequery."), &SinkLiveQuery::livequery, Syntax::EventDriven); 128 Syntax list("livequery", QObject::tr("Run a livequery."), &SinkLiveQuery::livequery, Syntax::EventDriven);
129 129
130 list.addPositionalArgument({ .name = "type", .help = "The type to run the livequery on" }); 130 list.addPositionalArgument({"type", "The type to run the livequery on" });
131 list.addParameter("resource", { .name = "resource", .help = "Filter the livequery to the given resource" }); 131 list.addParameter("resource", {"resource", "Filter the livequery to the given resource" });
132 list.addFlag("compact", "Use a compact view (reduces the size of IDs)"); 132 list.addFlag("compact", "Use a compact view (reduces the size of IDs)");
133 list.addParameter("filter", { .name = "property=$value", .help = "Filter the results" }); 133 list.addParameter("filter", {"property=$value", "Filter the results" });
134 list.addParameter("id", { .name = "id", .help = "List only the content with the given ID" }); 134 list.addParameter("id", {"id", "List only the content with the given ID" });
135 list.addFlag("showall", "Show all properties"); 135 list.addFlag("showall", "Show all properties");
136 list.addParameter("show", { .name = "property", .help = "Only show the given property" }); 136 list.addParameter("show", {"property", "Only show the given property" });
137 137
138 list.completer = &SinkshUtils::resourceOrTypeCompleter; 138 list.completer = &SinkshUtils::resourceOrTypeCompleter;
139 return Syntax::List() << list; 139 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)
101Syntax::List syntax() 101Syntax::List syntax()
102{ 102{
103 Syntax modify("modify", QObject::tr("Modify items in a resource"), &SinkModify::modify); 103 Syntax modify("modify", QObject::tr("Modify items in a resource"), &SinkModify::modify);
104 modify.addPositionalArgument({ .name = "type", .help = "The type of entity to modify (mail, event, etc.)" }); 104 modify.addPositionalArgument({"type", "The type of entity to modify (mail, event, etc.)"});
105 modify.addPositionalArgument({ .name = "resourceId", .help = "The ID of the resource containing the entity" }); 105 modify.addPositionalArgument({"resourceId", "The ID of the resource containing the entity"});
106 modify.addPositionalArgument({ .name = "objectId", .help = "The ID of the entity" }); 106 modify.addPositionalArgument({"objectId", "The ID of the entity"});
107 modify.addPositionalArgument( 107 modify.addPositionalArgument({"key value", "Attributes and values to modify", false, true });
108 { .name = "key value", .help = "Attributes and values to modify", .required = false, .variadic = true });
109 108
110 Syntax resource("resource", QObject::tr("Modify a resource"), &SinkModify::resource);//, Syntax::EventDriven); 109 Syntax resource("resource", QObject::tr("Modify a resource"), &SinkModify::resource);//, Syntax::EventDriven);
111 110
112 resource.addPositionalArgument({ .name = "id", .help = "The ID of the resource" }); 111 resource.addPositionalArgument({"id", "The ID of the resource" });
113 resource.addPositionalArgument( 112 resource.addPositionalArgument({"key value", "Attributes and values to modify", false, true});
114 { .name = "key value", .help = "Attributes and values to modify", .required = false, .variadic = true });
115 113
116 resource.completer = &SinkshUtils::resourceOrTypeCompleter; 114 resource.completer = &SinkshUtils::resourceOrTypeCompleter;
117 modify.children << resource; 115 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)
132Syntax::List syntax() 132Syntax::List syntax()
133{ 133{
134 Syntax remove("remove", QObject::tr("Remove items in a resource"), &SinkRemove::remove); 134 Syntax remove("remove", QObject::tr("Remove items in a resource"), &SinkRemove::remove);
135 135 remove.addPositionalArgument({"type", "The type of entity to remove (mail, event, etc.)"});
136 remove.addPositionalArgument({ .name = "type", .help = "The type of entity to remove (mail, event, etc.)" }); 136 remove.addPositionalArgument({"resourceId", "The ID of the resource containing the entity"});
137 remove.addPositionalArgument({ .name = "resourceId", .help = "The ID of the resource containing the entity" }); 137 remove.addPositionalArgument({"objectId", "The ID of the entity to remove"});
138 remove.addPositionalArgument({ .name = "objectId", .help = "The ID of the entity to remove" });
139 138
140 Syntax resource("resource", QObject::tr("Removes a resource"), &SinkRemove::resource, Syntax::NotInteractive); 139 Syntax resource("resource", QObject::tr("Removes a resource"), &SinkRemove::resource, Syntax::NotInteractive);
141 resource.addPositionalArgument({ .name = "id", .help = "The ID of the resource to remove" }); 140 resource.addPositionalArgument({"id", "The ID of the resource to remove"});
142 resource.completer = &SinkshUtils::resourceCompleter; 141 resource.completer = &SinkshUtils::resourceCompleter;
143 142
144 Syntax account("account", QObject::tr("Removes a account"), &SinkRemove::account, Syntax::NotInteractive); 143 Syntax account("account", QObject::tr("Removes a account"), &SinkRemove::account, Syntax::NotInteractive);
145 account.addPositionalArgument({ .name = "id", .help = "The ID of the account to remove" }); 144 account.addPositionalArgument({"id", "The ID of the account to remove"});
146 145
147 Syntax identity("identity", QObject::tr("Removes an identity"), &SinkRemove::identity, Syntax::NotInteractive); 146 Syntax identity("identity", QObject::tr("Removes an identity"), &SinkRemove::identity, Syntax::NotInteractive);
148 identity.addPositionalArgument({ .name = "id", .help = "The ID of the account to remove" }); 147 identity.addPositionalArgument({"id", "The ID of the account to remove"});
149 148
150 remove.children << resource << account << identity; 149 remove.children << resource << account << identity;
151 150
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)
101 101
102Syntax::List syntax() 102Syntax::List syntax()
103{ 103{
104 Syntax state("stat", QObject::tr("Shows database usage for the resources requested"), 104 Syntax state("stat", QObject::tr("Shows database usage for the resources requested"), &SinkStat::stat, Syntax::NotInteractive);
105 &SinkStat::stat, Syntax::NotInteractive); 105 state.addPositionalArgument({"resourceId", "Show statistics of the given resource(s). If no resource is provided, show statistics of all resources", false, true});
106
107 state.addPositionalArgument({ .name = "resourceId",
108 .help = "Show statistics of the given resource(s). If no resource is provided, show "
109 "statistics of all resources",
110 .required = false,
111 .variadic = true });
112
113 state.completer = &SinkshUtils::resourceCompleter; 106 state.completer = &SinkshUtils::resourceCompleter;
114
115 return Syntax::List() << state; 107 return Syntax::List() << state;
116} 108}
117 109
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()
84{ 84{
85 Syntax sync("sync", QObject::tr("Synchronizes a resource."), &SinkSync::sync, Syntax::EventDriven); 85 Syntax sync("sync", QObject::tr("Synchronizes a resource."), &SinkSync::sync, Syntax::EventDriven);
86 86
87 sync.addPositionalArgument({ .name = "type", .help = "The type of resource to synchronize" }); 87 sync.addPositionalArgument({"type", "The type of resource to synchronize"});
88 sync.addPositionalArgument({ .name = "resourceId", .help = "The ID of the resource to synchronize" }); 88 sync.addPositionalArgument({"resourceId", "The ID of the resource to synchronize"});
89 sync.addParameter("password", { .name = "password", .help = "The password of the resource", .required = true }); 89 sync.addParameter("password", {"password", "The password of the resource", true});
90 90
91 sync.completer = &SinkshUtils::resourceCompleter; 91 sync.completer = &SinkshUtils::resourceCompleter;
92 92