diff options
Diffstat (limited to 'sinksh/syntax_modules/sink_stat.cpp')
-rw-r--r-- | sinksh/syntax_modules/sink_stat.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sinksh/syntax_modules/sink_stat.cpp b/sinksh/syntax_modules/sink_stat.cpp index 7263941..a936af2 100644 --- a/sinksh/syntax_modules/sink_stat.cpp +++ b/sinksh/syntax_modules/sink_stat.cpp | |||
@@ -69,7 +69,6 @@ void statResource(const QString &resource, const State &state) | |||
69 | state.printLine(QObject::tr("Actual database file sizes total: %1 [kb]").arg(size), 1); | 69 | state.printLine(QObject::tr("Actual database file sizes total: %1 [kb]").arg(size), 1); |
70 | 70 | ||
71 | QDir dataDir{Sink::resourceStorageLocation(resource.toLatin1()) + "/fulltext/"}; | 71 | QDir dataDir{Sink::resourceStorageLocation(resource.toLatin1()) + "/fulltext/"}; |
72 | Q_ASSERT(dataDir.exists()); | ||
73 | qint64 dataSize = 0; | 72 | qint64 dataSize = 0; |
74 | for (const auto &e : dataDir.entryInfoList(QDir::Files | QDir::NoSymLinks | QDir::NoDotAndDotDot)) { | 73 | for (const auto &e : dataDir.entryInfoList(QDir::Files | QDir::NoSymLinks | QDir::NoDotAndDotDot)) { |
75 | dataSize += e.size(); | 74 | dataSize += e.size(); |
@@ -102,7 +101,15 @@ bool stat(const QStringList &args, State &state) | |||
102 | 101 | ||
103 | Syntax::List syntax() | 102 | Syntax::List syntax() |
104 | { | 103 | { |
105 | Syntax state("stat", QObject::tr("Shows database usage for the resources requested"), &SinkStat::stat, Syntax::NotInteractive); | 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 | |||
106 | state.completer = &SinkshUtils::resourceCompleter; | 113 | state.completer = &SinkshUtils::resourceCompleter; |
107 | 114 | ||
108 | return Syntax::List() << state; | 115 | return Syntax::List() << state; |