1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00
joplin/CliClient/app/command-export-sync-status.js

37 lines
817 B
JavaScript
Raw Normal View History

const { BaseCommand } = require('./base-command.js');
const { app } = require('./app.js');
2017-12-14 20:12:14 +02:00
const Setting = require('lib/models/Setting.js');
const { ReportService } = require('lib/services/report.js');
const fs = require('fs-extra');
class Command extends BaseCommand {
usage() {
return 'export-sync-status';
}
description() {
return 'Export sync status';
}
hidden() {
return true;
}
async action() {
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`;
await fs.writeFileSync(filePath, csv);
2019-09-19 23:51:18 +02:00
this.stdout(`Sync status exported to ${filePath}`);
app()
.gui()
.showConsole();
app()
.gui()
.maximizeConsole();
}
}
module.exports = Command;