2022-11-01 17:28:14 +02:00
|
|
|
const BaseCommand = require('./base-command').default;
|
2017-11-21 20:48:50 +02:00
|
|
|
const { app } = require('./app.js');
|
2020-11-07 17:59:37 +02:00
|
|
|
const Setting = require('@joplin/lib/models/Setting').default;
|
2021-01-22 19:41:11 +02:00
|
|
|
const ReportService = require('@joplin/lib/services/ReportService').default;
|
2017-11-21 20:48:50 +02:00
|
|
|
const fs = require('fs-extra');
|
|
|
|
|
|
|
|
class Command extends BaseCommand {
|
|
|
|
usage() {
|
|
|
|
return 'export-sync-status';
|
|
|
|
}
|
|
|
|
|
|
|
|
description() {
|
|
|
|
return 'Export sync status';
|
|
|
|
}
|
|
|
|
|
|
|
|
hidden() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-09-13 00:16:42 +02:00
|
|
|
async action() {
|
2017-11-21 20:48:50 +02:00
|
|
|
const service = new ReportService();
|
|
|
|
const csv = await service.basicItemList({ format: 'csv' });
|
2019-09-19 23:51:18 +02:00
|
|
|
const filePath = `${Setting.value('profileDir')}/syncReport-${new Date().getTime()}.csv`;
|
2017-11-21 20:48:50 +02:00
|
|
|
await fs.writeFileSync(filePath, csv);
|
2019-09-19 23:51:18 +02:00
|
|
|
this.stdout(`Sync status exported to ${filePath}`);
|
2017-11-21 20:48:50 +02:00
|
|
|
|
2019-07-30 09:35:42 +02:00
|
|
|
app()
|
|
|
|
.gui()
|
|
|
|
.showConsole();
|
|
|
|
app()
|
|
|
|
.gui()
|
|
|
|
.maximizeConsole();
|
2017-11-21 20:48:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-30 09:35:42 +02:00
|
|
|
module.exports = Command;
|