diff options
Diffstat (limited to 'sinksh/syntax_modules/sink_list.cpp')
-rw-r--r-- | sinksh/syntax_modules/sink_list.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/sinksh/syntax_modules/sink_list.cpp b/sinksh/syntax_modules/sink_list.cpp index 32fae4f..eef188b 100644 --- a/sinksh/syntax_modules/sink_list.cpp +++ b/sinksh/syntax_modules/sink_list.cpp | |||
@@ -39,6 +39,8 @@ | |||
39 | namespace SinkList | 39 | namespace SinkList |
40 | { | 40 | { |
41 | 41 | ||
42 | Syntax::List syntax(); | ||
43 | |||
42 | static QByteArray compressId(bool compress, const QByteArray &id) | 44 | static QByteArray compressId(bool compress, const QByteArray &id) |
43 | { | 45 | { |
44 | if (!compress) { | 46 | if (!compress) { |
@@ -117,7 +119,7 @@ QStringList printToList(const Sink::ApplicationDomain::ApplicationDomainType &o, | |||
117 | bool list(const QStringList &args_, State &state) | 119 | bool list(const QStringList &args_, State &state) |
118 | { | 120 | { |
119 | if (args_.isEmpty()) { | 121 | if (args_.isEmpty()) { |
120 | state.printError(QObject::tr("Options: $type [--resource $resource] [--compact] [--filter $property=$value] [--id $id] [--showall|--show $property] [--reduce $reduceProperty:$selectorProperty] [--sort $sortProperty] [--limit $count]")); | 122 | state.printError(syntax()[0].usage()); |
121 | return false; | 123 | return false; |
122 | } | 124 | } |
123 | 125 | ||
@@ -127,7 +129,7 @@ bool list(const QStringList &args_, State &state) | |||
127 | Sink::Query query; | 129 | Sink::Query query; |
128 | query.setId("list"); | 130 | query.setId("list"); |
129 | if (!SinkshUtils::applyFilter(query, options)) { | 131 | if (!SinkshUtils::applyFilter(query, options)) { |
130 | state.printError(QObject::tr("Options: $type [--resource $resource] [--compact] [--filter $property=$value] [--showall|--show $property]")); | 132 | state.printError(syntax()[0].usage()); |
131 | return false; | 133 | return false; |
132 | } | 134 | } |
133 | 135 | ||
@@ -198,6 +200,18 @@ bool list(const QStringList &args_, State &state) | |||
198 | Syntax::List syntax() | 200 | Syntax::List syntax() |
199 | { | 201 | { |
200 | 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 | |||
204 | list.addPositionalArgument({.name = "type", .help = "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" }); | ||
206 | list.addFlag("compact", "Use a compact view (reduces the size of IDs)"); | ||
207 | list.addParameter("filter", { .name = "property=$value", .help = "Filter the results" }); | ||
208 | list.addParameter("id", { .name = "id", .help = "List only the content with the given ID" }); | ||
209 | list.addFlag("showall", "Show all properties"); | ||
210 | list.addParameter("show", { .name = "property", .help = "Only show the given property" }); | ||
211 | list.addParameter("reduce", { .name = "property:$selectorProperty", .help = "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" }); | ||
213 | list.addParameter("limit", { .name = "count", .help = "Limit the results" }); | ||
214 | |||
201 | list.completer = &SinkshUtils::resourceOrTypeCompleter; | 215 | list.completer = &SinkshUtils::resourceOrTypeCompleter; |
202 | return Syntax::List() << list; | 216 | return Syntax::List() << list; |
203 | } | 217 | } |