1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-21 09:38:01 +02:00
joplin/packages/app-cli/app/command-export-sync-status.ts

37 lines
882 B
TypeScript
Raw Normal View History

import BaseCommand from './base-command';
const { app } = require('./app.js');
import Setting from '@joplin/lib/models/Setting';
import ReportService from '@joplin/lib/services/ReportService';
import * as fs from 'fs-extra';
class Command extends BaseCommand {
public override usage() {
return 'export-sync-status';
}
public override description() {
return 'Export sync status';
}
public override hidden() {
return true;
}
public override async action() {
const service = new ReportService();
const csv = await service.basicItemList({ format: 'csv' }) as string;
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;