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