2017-11-03 02:09:34 +02:00
|
|
|
const { BaseCommand } = require('./base-command.js');
|
|
|
|
const { Database } = require('lib/database.js');
|
|
|
|
const { app } = require('./app.js');
|
2017-12-14 20:12:14 +02:00
|
|
|
const Setting = require('lib/models/Setting.js');
|
2017-11-03 02:09:34 +02:00
|
|
|
const { _ } = require('lib/locale.js');
|
|
|
|
const { ReportService } = require('lib/services/report.js');
|
2017-07-13 20:09:47 +02:00
|
|
|
|
|
|
|
class Command extends BaseCommand {
|
|
|
|
|
|
|
|
usage() {
|
|
|
|
return 'status';
|
|
|
|
}
|
|
|
|
|
|
|
|
description() {
|
2017-07-18 20:21:03 +02:00
|
|
|
return _('Displays summary about the notes and notebooks.');
|
2017-07-13 20:09:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
async action(args) {
|
|
|
|
let service = new ReportService();
|
2017-07-24 20:58:11 +02:00
|
|
|
let report = await service.status(Setting.value('sync.target'));
|
2017-07-13 20:09:47 +02:00
|
|
|
|
|
|
|
for (let i = 0; i < report.length; i++) {
|
|
|
|
let section = report[i];
|
|
|
|
|
2017-10-07 18:30:27 +02:00
|
|
|
if (i > 0) this.stdout('');
|
2017-07-13 20:09:47 +02:00
|
|
|
|
2017-10-07 18:30:27 +02:00
|
|
|
this.stdout('# ' + section.title);
|
|
|
|
this.stdout('');
|
2017-07-13 20:09:47 +02:00
|
|
|
|
|
|
|
for (let n in section.body) {
|
|
|
|
if (!section.body.hasOwnProperty(n)) continue;
|
|
|
|
let line = section.body[n];
|
2017-10-07 18:30:27 +02:00
|
|
|
this.stdout(line);
|
2017-07-13 20:09:47 +02:00
|
|
|
}
|
|
|
|
}
|
2017-10-25 19:23:45 +02:00
|
|
|
|
|
|
|
app().gui().showConsole();
|
|
|
|
app().gui().maximizeConsole();
|
2017-07-13 20:09:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Command;
|