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

37 lines
870 B
TypeScript
Raw Normal View History

import BaseCommand from './base-command';
2024-01-20 16:29:21 +02:00
import app from './app';
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;