joplin/CliClient/app/command-status.js

39 lines
876 B
JavaScript
Raw Normal View History

2017-07-13 18:09:47 +00:00
import { BaseCommand } from './base-command.js';
2017-07-16 16:06:05 +00:00
import { Database } from 'lib/database.js';
import { Setting } from 'lib/models/setting.js';
2017-07-13 18:09:47 +00:00
import { _ } from 'lib/locale.js';
import { ReportService } from 'lib/services/report.js';
class Command extends BaseCommand {
usage() {
return 'status';
}
description() {
return 'Displays summary about the notes and notebooks.';
}
async action(args) {
let service = new ReportService();
2017-07-16 16:06:05 +00:00
let report = await service.status(Database.enumId('syncTarget', Setting.value('sync.target')));
2017-07-13 18:09:47 +00:00
for (let i = 0; i < report.length; i++) {
let section = report[i];
if (i > 0) this.log('');
this.log('# ' + section.title);
this.log('');
for (let n in section.body) {
if (!section.body.hasOwnProperty(n)) continue;
let line = section.body[n];
this.log(line);
}
}
}
}
module.exports = Command;