2020-11-17 16:50:28 +02:00
|
|
|
import { CommandRuntime, CommandDeclaration } from '@joplin/lib/services/CommandService';
|
|
|
|
import InteropService from '@joplin/lib/services/interop/InteropService';
|
2023-12-15 20:18:11 +02:00
|
|
|
import { ExportModuleOutputFormat, ExportOptions, FileSystemItem } from '@joplin/lib/services/interop/types';
|
2020-11-17 16:50:28 +02:00
|
|
|
|
|
|
|
export const declaration: CommandDeclaration = {
|
|
|
|
name: 'exportNotes',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const runtime = (): CommandRuntime => {
|
|
|
|
return {
|
2024-04-05 13:16:49 +02:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
2023-12-15 20:18:11 +02:00
|
|
|
execute: async (_context: any, noteIds: string[], format: ExportModuleOutputFormat, targetDirectoryPath: string) => {
|
2020-11-17 16:50:28 +02:00
|
|
|
const exportOptions: ExportOptions = {
|
|
|
|
path: targetDirectoryPath,
|
|
|
|
format: format,
|
|
|
|
target: FileSystemItem.Directory,
|
|
|
|
sourceNoteIds: noteIds,
|
|
|
|
};
|
|
|
|
|
|
|
|
return InteropService.instance().export(exportOptions);
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|