summaryrefslogtreecommitdiffstats
path: root/sinksh/syntax_modules/sink_list.cpp
diff options
context:
space:
mode:
authorMinijackson <minijackson@riseup.net>2018-08-02 14:08:35 +0200
committerMinijackson <minijackson@riseup.net>2018-08-02 14:08:35 +0200
commitc82c80d031d50e445bda7c02adbd3e97a635cde6 (patch)
tree7ac90aaa7c8ac9561dfd10d730052a38c07b01ee /sinksh/syntax_modules/sink_list.cpp
parent80c42b9707c7c44b7379734575c1b82fc97e95bf (diff)
downloadsinksh-better-cli.tar.gz
sinksh-better-cli.zip
Put "syntax" at the bottomsinksh-better-cli
Diffstat (limited to 'sinksh/syntax_modules/sink_list.cpp')
-rw-r--r--sinksh/syntax_modules/sink_list.cpp44
1 files changed, 22 insertions, 22 deletions
diff --git a/sinksh/syntax_modules/sink_list.cpp b/sinksh/syntax_modules/sink_list.cpp
index c091cd4..903dc2a 100644
--- a/sinksh/syntax_modules/sink_list.cpp
+++ b/sinksh/syntax_modules/sink_list.cpp
@@ -39,28 +39,7 @@
39namespace SinkList 39namespace SinkList
40{ 40{
41 41
42bool list(const QStringList &args_, State &state); 42Syntax::List syntax();
43
44Syntax::List syntax()
45{
46 Syntax list("list", QObject::tr("List all resources, or the contents of one or more resources."), &SinkList::list, Syntax::NotInteractive);
47
48 list.addPositionalArgument({.name = "type", .help = "The type of content to list (resource, identity, account, mail, etc.)"});
49 list.addParameter("resource", { .name = "resource", .help = "List only the content of the given resource" });
50 list.addFlag("compact", "Use a compact view (reduces the size of IDs)");
51 list.addParameter("filter", { .name = "property=$value", .help = "Filter the results" });
52 list.addParameter("id", { .name = "id", .help = "List only the content with the given ID" });
53 list.addFlag("showall", "Show all properties");
54 list.addParameter("show", { .name = "property", .help = "Only show the given property" });
55 list.addParameter("reduce", { .name = "property:$selectorProperty", .help = "Combine the result with the same $property, sorted by $selectorProperty" });
56 list.addParameter("sort", { .name = "property", .help = "Sort the results according to the given property" });
57 list.addParameter("limit", { .name = "count", .help = "Limit the results" });
58
59 list.completer = &SinkshUtils::resourceOrTypeCompleter;
60 return Syntax::List() << list;
61}
62
63REGISTER_SYNTAX(SinkList)
64 43
65static QByteArray compressId(bool compress, const QByteArray &id) 44static QByteArray compressId(bool compress, const QByteArray &id)
66{ 45{
@@ -216,4 +195,25 @@ bool list(const QStringList &args_, State &state)
216 return true; 195 return true;
217} 196}
218 197
198Syntax::List syntax()
199{
200 Syntax list("list", QObject::tr("List all resources, or the contents of one or more resources."), &SinkList::list, Syntax::NotInteractive);
201
202 list.addPositionalArgument({.name = "type", .help = "The type of content to list (resource, identity, account, mail, etc.)"});
203 list.addParameter("resource", { .name = "resource", .help = "List only the content of the given resource" });
204 list.addFlag("compact", "Use a compact view (reduces the size of IDs)");
205 list.addParameter("filter", { .name = "property=$value", .help = "Filter the results" });
206 list.addParameter("id", { .name = "id", .help = "List only the content with the given ID" });
207 list.addFlag("showall", "Show all properties");
208 list.addParameter("show", { .name = "property", .help = "Only show the given property" });
209 list.addParameter("reduce", { .name = "property:$selectorProperty", .help = "Combine the result with the same $property, sorted by $selectorProperty" });
210 list.addParameter("sort", { .name = "property", .help = "Sort the results according to the given property" });
211 list.addParameter("limit", { .name = "count", .help = "Limit the results" });
212
213 list.completer = &SinkshUtils::resourceOrTypeCompleter;
214 return Syntax::List() << list;
215}
216
217REGISTER_SYNTAX(SinkList)
218
219} 219}