mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-18 09:35:20 +02:00
36 lines
906 B
JavaScript
36 lines
906 B
JavaScript
const { BaseCommand } = require('./base-command.js');
|
|
const { Database } = require('lib/database.js');
|
|
const { app } = require('./app.js');
|
|
const { Setting } = require('lib/models/setting.js');
|
|
const { _ } = require('lib/locale.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(args) {
|
|
const service = new ReportService();
|
|
const csv = await service.basicItemList({ format: 'csv' });
|
|
const filePath = Setting.value('profileDir') + '/syncReport-' + (new Date()).getTime() + '.csv';
|
|
await fs.writeFileSync(filePath, csv);
|
|
this.stdout('Sync status exported to ' + filePath);
|
|
|
|
app().gui().showConsole();
|
|
app().gui().maximizeConsole();
|
|
}
|
|
|
|
}
|
|
|
|
module.exports = Command; |