diff --git a/packages/cli/src/commands/connect/notesInfo.ts b/packages/cli/src/commands/connect/notesInfo.ts new file mode 100644 index 0000000..25c09bf --- /dev/null +++ b/packages/cli/src/commands/connect/notesInfo.ts @@ -0,0 +1,36 @@ +import { invoke } from "@autoanki/anki-connect"; +import { Args, Command } from "@oclif/core"; + +export default class NotesInfo extends Command { + static description = + "Returns a list of objects containing for each note ID the note fields, tags, note type and the cards belonging to the note."; + + static strict = false; + static enableJsonFlag = true; + + static args = { + noteIds: Args.integer({ + required: true, + }), + }; + + static examples = [ + "<%= config.bin %> <%= command.id %> notesInfo 123", + "<%= config.bin %> <%= command.id %> notesInfo 123 456", + ]; + + public async run(): Promise { + const { argv } = await this.parse(NotesInfo); + + const result = await invoke({ + action: "notesInfo", + version: 6, + request: { + notes: argv.map((i) => parseInt(i as string, 10)), + }, + }); + this.log(JSON.stringify(result)); + + return result; + } +}