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

37 lines
882 B
TypeScript

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;
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;