summaryrefslogtreecommitdiffstats
path: root/sinksh/syntax_modules/sink_inspect.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sinksh/syntax_modules/sink_inspect.cpp')
-rw-r--r--sinksh/syntax_modules/sink_inspect.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/sinksh/syntax_modules/sink_inspect.cpp b/sinksh/syntax_modules/sink_inspect.cpp
index f9cc50a..355efa3 100644
--- a/sinksh/syntax_modules/sink_inspect.cpp
+++ b/sinksh/syntax_modules/sink_inspect.cpp
@@ -55,10 +55,14 @@ QString parse(const QByteArray &bytes)
55 } 55 }
56} 56}
57 57
58Syntax::List syntax();
59
58bool inspect(const QStringList &args, State &state) 60bool inspect(const QStringList &args, State &state)
59{ 61{
60 if (args.isEmpty()) { 62 if (args.isEmpty()) {
61 state.printError(QObject::tr("Options: [--resource $resource] ([--db $db] [--filter $id] [--showinternal] | [--validaterids $type] | [--fulltext [$id]])")); 63 //state.printError(QObject::tr("Options: [--resource $resource] ([--db $db] [--filter $id] [--showinternal] | [--validaterids $type] | [--fulltext [$id]])"));
64 state.printError(syntax()[0].usage());
65 return false;
62 } 66 }
63 auto options = SyntaxTree::parseOptions(args); 67 auto options = SyntaxTree::parseOptions(args);
64 auto resource = SinkshUtils::parseUid(options.options.value("resource").value(0).toUtf8()); 68 auto resource = SinkshUtils::parseUid(options.options.value("resource").value(0).toUtf8());
@@ -236,7 +240,21 @@ bool inspect(const QStringList &args, State &state)
236 240
237Syntax::List syntax() 241Syntax::List syntax()
238{ 242{
239 Syntax state("inspect", QObject::tr("Inspect database for the resource requested"), &SinkInspect::inspect, Syntax::NotInteractive); 243 Syntax state("inspect", QObject::tr("Inspect database for the resource requested"),
244 &SinkInspect::inspect, Syntax::NotInteractive);
245
246 state.addParameter("resource",
247 { .name = "resource", .help = "Which resource to inspect", .required = true });
248 state.addParameter("db",
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");
253 state.addParameter("validaterids",
254 { .name = "type", .help = "Validate remote Ids of the given type"});
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
240 state.completer = &SinkshUtils::resourceCompleter; 258 state.completer = &SinkshUtils::resourceCompleter;
241 259
242 return Syntax::List() << state; 260 return Syntax::List() << state;