diff options
author | Minijackson <minijackson@riseup.net> | 2018-08-02 14:08:35 +0200 |
---|---|---|
committer | Minijackson <minijackson@riseup.net> | 2018-08-02 14:08:35 +0200 |
commit | c82c80d031d50e445bda7c02adbd3e97a635cde6 (patch) | |
tree | 7ac90aaa7c8ac9561dfd10d730052a38c07b01ee /sinksh/syntax_modules/sink_modify.cpp | |
parent | 80c42b9707c7c44b7379734575c1b82fc97e95bf (diff) | |
download | sinksh-better-cli.tar.gz sinksh-better-cli.zip |
Put "syntax" at the bottomsinksh-better-cli
Diffstat (limited to 'sinksh/syntax_modules/sink_modify.cpp')
-rw-r--r-- | sinksh/syntax_modules/sink_modify.cpp | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/sinksh/syntax_modules/sink_modify.cpp b/sinksh/syntax_modules/sink_modify.cpp index cd29d56..6cda5ab 100644 --- a/sinksh/syntax_modules/sink_modify.cpp +++ b/sinksh/syntax_modules/sink_modify.cpp | |||
@@ -38,31 +38,7 @@ | |||
38 | namespace SinkModify | 38 | namespace SinkModify |
39 | { | 39 | { |
40 | 40 | ||
41 | bool modify(const QStringList &args, State &state); | 41 | Syntax::List syntax(); |
42 | bool resource(const QStringList &args, State &state); | ||
43 | |||
44 | Syntax::List syntax() | ||
45 | { | ||
46 | Syntax modify("modify", QObject::tr("Modify items in a resource"), &SinkModify::modify); | ||
47 | modify.addPositionalArgument({ .name = "type", .help = "The type of entity to modify (mail, event, etc.)" }); | ||
48 | modify.addPositionalArgument({ .name = "resourceId", .help = "The ID of the resource containing the entity" }); | ||
49 | modify.addPositionalArgument({ .name = "objectId", .help = "The ID of the entity" }); | ||
50 | modify.addPositionalArgument( | ||
51 | { .name = "key value", .help = "Attributes and values to modify", .required = false, .variadic = true }); | ||
52 | |||
53 | Syntax resource("resource", QObject::tr("Modify a resource"), &SinkModify::resource);//, Syntax::EventDriven); | ||
54 | |||
55 | resource.addPositionalArgument({ .name = "id", .help = "The ID of the resource" }); | ||
56 | resource.addPositionalArgument( | ||
57 | { .name = "key value", .help = "Attributes and values to modify", .required = false, .variadic = true }); | ||
58 | |||
59 | resource.completer = &SinkshUtils::resourceOrTypeCompleter; | ||
60 | modify.children << resource; | ||
61 | |||
62 | return Syntax::List() << modify; | ||
63 | } | ||
64 | |||
65 | REGISTER_SYNTAX(SinkModify) | ||
66 | 42 | ||
67 | bool modify(const QStringList &args, State &state) | 43 | bool modify(const QStringList &args, State &state) |
68 | { | 44 | { |
@@ -122,4 +98,27 @@ bool resource(const QStringList &args, State &state) | |||
122 | return true; | 98 | return true; |
123 | } | 99 | } |
124 | 100 | ||
101 | Syntax::List syntax() | ||
102 | { | ||
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.)" }); | ||
105 | modify.addPositionalArgument({ .name = "resourceId", .help = "The ID of the resource containing the entity" }); | ||
106 | modify.addPositionalArgument({ .name = "objectId", .help = "The ID of the entity" }); | ||
107 | modify.addPositionalArgument( | ||
108 | { .name = "key value", .help = "Attributes and values to modify", .required = false, .variadic = true }); | ||
109 | |||
110 | Syntax resource("resource", QObject::tr("Modify a resource"), &SinkModify::resource);//, Syntax::EventDriven); | ||
111 | |||
112 | resource.addPositionalArgument({ .name = "id", .help = "The ID of the resource" }); | ||
113 | resource.addPositionalArgument( | ||
114 | { .name = "key value", .help = "Attributes and values to modify", .required = false, .variadic = true }); | ||
115 | |||
116 | resource.completer = &SinkshUtils::resourceOrTypeCompleter; | ||
117 | modify.children << resource; | ||
118 | |||
119 | return Syntax::List() << modify; | ||
120 | } | ||
121 | |||
122 | REGISTER_SYNTAX(SinkModify) | ||
123 | |||
125 | } | 124 | } |