Skip to content

Commit

Permalink
feat(connect): notesInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
timgreen committed Mar 12, 2023
1 parent 2e00764 commit 10178a3
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions packages/cli/src/commands/connect/notesInfo.ts
Original file line number Diff line number Diff line change
@@ -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<any> {
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;
}
}

0 comments on commit 10178a3

Please sign in to comment.