summaryrefslogtreecommitdiffstats
path: root/sinksh/syntax_modules/sink_modify.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_modify.cpp
parent80c42b9707c7c44b7379734575c1b82fc97e95bf (diff)
downloadsink-c82c80d031d50e445bda7c02adbd3e97a635cde6.tar.gz
sink-c82c80d031d50e445bda7c02adbd3e97a635cde6.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.cpp49
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 @@
38namespace SinkModify 38namespace SinkModify
39{ 39{
40 40
41bool modify(const QStringList &args, State &state); 41Syntax::List syntax();
42bool resource(const QStringList &args, State &state);
43
44Syntax::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
65REGISTER_SYNTAX(SinkModify)
66 42
67bool modify(const QStringList &args, State &state) 43bool 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
101Syntax::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
122REGISTER_SYNTAX(SinkModify)
123
125} 124}