Changeset View
Changeset View
Standalone View
Standalone View
src/tools/balooctl/main.cpp
Show First 20 Lines • Show All 81 Lines • ▼ Show 20 Line(s) | 66 | { | |||
---|---|---|---|---|---|
82 | parser.addPositionalArgument(QStringLiteral("restart"), i18n("Restart the file indexer")); | 82 | parser.addPositionalArgument(QStringLiteral("restart"), i18n("Restart the file indexer")); | ||
83 | parser.addPositionalArgument(QStringLiteral("suspend"), i18n("Suspend the file indexer")); | 83 | parser.addPositionalArgument(QStringLiteral("suspend"), i18n("Suspend the file indexer")); | ||
84 | parser.addPositionalArgument(QStringLiteral("resume"), i18n("Resume the file indexer")); | 84 | parser.addPositionalArgument(QStringLiteral("resume"), i18n("Resume the file indexer")); | ||
85 | parser.addPositionalArgument(QStringLiteral("check"), i18n("Check for any unindexed files and index them")); | 85 | parser.addPositionalArgument(QStringLiteral("check"), i18n("Check for any unindexed files and index them")); | ||
86 | parser.addPositionalArgument(QStringLiteral("index"), i18n("Index the specified files")); | 86 | parser.addPositionalArgument(QStringLiteral("index"), i18n("Index the specified files")); | ||
87 | parser.addPositionalArgument(QStringLiteral("clear"), i18n("Forget the specified files")); | 87 | parser.addPositionalArgument(QStringLiteral("clear"), i18n("Forget the specified files")); | ||
88 | parser.addPositionalArgument(QStringLiteral("config"), i18n("Modify the Baloo configuration")); | 88 | parser.addPositionalArgument(QStringLiteral("config"), i18n("Modify the Baloo configuration")); | ||
89 | parser.addPositionalArgument(QStringLiteral("monitor"), i18n("Monitor the file indexer")); | 89 | parser.addPositionalArgument(QStringLiteral("monitor"), i18n("Monitor the file indexer")); | ||
90 | parser.addPositionalArgument(QStringLiteral("prune"), i18n("Purge the index of unresolvable file paths (e.g. deleted files)")); | ||||
michaelh: Just 'prune'? | |||||
90 | parser.addPositionalArgument(QStringLiteral("indexSize"), i18n("Display the disk space used by index")); | 91 | parser.addPositionalArgument(QStringLiteral("indexSize"), i18n("Display the disk space used by index")); | ||
91 | parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("f") << QStringLiteral("format"), | 92 | parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("f") << QStringLiteral("format"), | ||
92 | i18n("Output format <%1|%2|%3>.\nOnly applies to \"%4\"", | 93 | i18n("Output format <%1|%2|%3>.\nOnly applies to \"%4\"", | ||
93 | QStringLiteral("json"), | 94 | QStringLiteral("json"), | ||
94 | QStringLiteral("simple"), | 95 | QStringLiteral("simple"), | ||
95 | QStringLiteral("multiline (default)"), | 96 | QStringLiteral("multiline (default)"), | ||
96 | QStringLiteral("balooctl status <file>") | 97 | QStringLiteral("balooctl status <file>") | ||
97 | ) | 98 | ) | ||
▲ Show 20 Lines • Show All 219 Lines • ▼ Show 20 Line(s) | 275 | if (command == QStringLiteral("indexSize")) { | |||
317 | return 0; | 318 | return 0; | ||
318 | } | 319 | } | ||
319 | 320 | | |||
320 | if (command == QStringLiteral("monitor")) { | 321 | if (command == QStringLiteral("monitor")) { | ||
321 | MonitorCommand mon; | 322 | MonitorCommand mon; | ||
322 | return mon.exec(parser); | 323 | return mon.exec(parser); | ||
323 | } | 324 | } | ||
324 | 325 | | |||
326 | if (command == QStringLiteral("prune")) { | ||||
michaelh: see above | |||||
327 | Database *db = globalDatabaseInstance(); | ||||
328 | if (!db->open(Database::ReadOnlyDatabase)) { | ||||
michaelh: Database::ReadWriteDatabase | |||||
329 | err << "Baloo Index could not be opened\n"; | ||||
michaelh: stderr | |||||
330 | return 1; | ||||
331 | } | ||||
332 | | ||||
333 | Transaction tr(db, Transaction::ReadOnly); | ||||
334 | tr.pruneFsTree(); | ||||
michaelh: stderr | |||||
335 | return 0; | ||||
336 | } | ||||
337 | | ||||
325 | /* | 338 | /* | ||
326 | TODO: Make separate executable | 339 | TODO: Make separate executable | ||
327 | if (command == QStringLiteral("checkDb")) { | 340 | if (command == QStringLiteral("checkDb")) { | ||
328 | Database *db = globalDatabaseInstance(); | 341 | Database *db = globalDatabaseInstance(); | ||
329 | if (!db->open(Database::ReadOnlyDatabase)) { | 342 | if (!db->open(Database::ReadOnlyDatabase)) { | ||
330 | out << "Baloo Index could not be opened\n"; | 343 | out << "Baloo Index could not be opened\n"; | ||
331 | return 1; | 344 | return 1; | ||
332 | } | 345 | } | ||
Show All 13 Lines |
Just 'prune'?