@wilm-ai/wilma-cli 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +20 -2
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -354,7 +354,16 @@ async function handleCommand(args, config) {
354
354
  }
355
355
  if (command === "news") {
356
356
  if (subcommand === "read" && flags.id) {
357
- await outputNewsItem(client, Number(flags.id), flags.json);
357
+ const studentInfo = await resolveStudentForFlags(profile, config, flags.student);
358
+ if (!studentInfo && !profile.studentNumber) {
359
+ await printStudentSelectionHelp(profile, config);
360
+ return;
361
+ }
362
+ const perStudentClient = await WilmaClient.login({
363
+ ...profile,
364
+ studentNumber: studentInfo?.studentNumber ?? profile.studentNumber,
365
+ });
366
+ await outputNewsItem(perStudentClient, Number(flags.id), flags.json);
358
367
  return;
359
368
  }
360
369
  if (flags.allStudents) {
@@ -379,7 +388,16 @@ async function handleCommand(args, config) {
379
388
  }
380
389
  if (command === "messages") {
381
390
  if (subcommand === "read" && flags.id) {
382
- await outputMessageItem(client, Number(flags.id), flags.json);
391
+ const studentInfo = await resolveStudentForFlags(profile, config, flags.student);
392
+ if (!studentInfo && !profile.studentNumber) {
393
+ await printStudentSelectionHelp(profile, config);
394
+ return;
395
+ }
396
+ const perStudentClient = await WilmaClient.login({
397
+ ...profile,
398
+ studentNumber: studentInfo?.studentNumber ?? profile.studentNumber,
399
+ });
400
+ await outputMessageItem(perStudentClient, Number(flags.id), flags.json);
383
401
  return;
384
402
  }
385
403
  if (flags.allStudents) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wilm-ai/wilma-cli",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "@inquirer/prompts": "^5.3.8",
13
- "@wilm-ai/wilma-client": "^0.0.3"
13
+ "@wilm-ai/wilma-client": "^0.0.4"
14
14
  },
15
15
  "devDependencies": {
16
16
  "typescript": "^5.6.3"