summaryrefslogtreecommitdiffstats
path: root/sinksh/syntax_modules/sink_stat.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sinksh/syntax_modules/sink_stat.cpp')
-rw-r--r--sinksh/syntax_modules/sink_stat.cpp38
1 files changed, 18 insertions, 20 deletions
diff --git a/sinksh/syntax_modules/sink_stat.cpp b/sinksh/syntax_modules/sink_stat.cpp
index 235558f..a936af2 100644
--- a/sinksh/syntax_modules/sink_stat.cpp
+++ b/sinksh/syntax_modules/sink_stat.cpp
@@ -36,26 +36,6 @@
36namespace SinkStat 36namespace SinkStat
37{ 37{
38 38
39bool stat(const QStringList &args, State &state);
40
41Syntax::List syntax()
42{
43 Syntax state("stat", QObject::tr("Shows database usage for the resources requested"),
44 &SinkStat::stat, Syntax::NotInteractive);
45
46 state.addPositionalArgument({ .name = "resourceId",
47 .help = "Show statistics of the given resource(s). If no resource is provided, show "
48 "statistics of all resources",
49 .required = false,
50 .variadic = true });
51
52 state.completer = &SinkshUtils::resourceCompleter;
53
54 return Syntax::List() << state;
55}
56
57REGISTER_SYNTAX(SinkStat)
58
59void statResource(const QString &resource, const State &state) 39void statResource(const QString &resource, const State &state)
60{ 40{
61 state.printLine("Resource " + resource + ":"); 41 state.printLine("Resource " + resource + ":");
@@ -119,4 +99,22 @@ bool stat(const QStringList &args, State &state)
119 return false; 99 return false;
120} 100}
121 101
102Syntax::List syntax()
103{
104 Syntax state("stat", QObject::tr("Shows database usage for the resources requested"),
105 &SinkStat::stat, Syntax::NotInteractive);
106
107 state.addPositionalArgument({ .name = "resourceId",
108 .help = "Show statistics of the given resource(s). If no resource is provided, show "
109 "statistics of all resources",
110 .required = false,
111 .variadic = true });
112
113 state.completer = &SinkshUtils::resourceCompleter;
114
115 return Syntax::List() << state;
116}
117
118REGISTER_SYNTAX(SinkStat)
119
122} 120}