@jutge.org/toolkit 4.4.31 → 4.4.33

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jutge.org/toolkit",
3
3
  "description": "Toolkit to prepare problems for Jutge.org",
4
- "version": "4.4.31",
4
+ "version": "4.4.33",
5
5
  "homepage": "https://jutge.org",
6
6
  "author": {
7
7
  "name": "Jutge.org",
package/toolkit/share.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { password } from '@inquirer/prompts'
2
2
  import { Command } from '@commander-js/extra-typings'
3
- import { updateSharingSettings } from '../lib/share'
3
+ import { shareWith, showSharingSettings, updateSharingSettings } from '../lib/share'
4
4
 
5
5
  export const cmdShare = new Command('share')
6
6
  .summary('Update and show sharing settings')
@@ -48,3 +48,36 @@ Finally, it updates problem.yml file with the current sharing settings and shows
48
48
 
49
49
  await updateSharingSettings(opts.directory, { passcode, testcases, solutions })
50
50
  })
51
+
52
+ cmdShare.command('show')
53
+ .summary('Show sharing settings')
54
+ .description(
55
+ `Show sharing settings
56
+
57
+ This command shows the current sharing settings for the problem.
58
+ `,
59
+ )
60
+ .option('-d, --directory <directory>', 'problem directory', '.')
61
+ .action(async ({ directory }) => {
62
+ await showSharingSettings(directory)
63
+ })
64
+
65
+ cmdShare.command('with')
66
+ .summary('Share passcode with users')
67
+ .description(
68
+ `Share passcode with users
69
+
70
+ This command shares the passcode with users via their email addresses.
71
+ If the passcode is not set, nothing will happen.
72
+ If some address is not valid or not found in Jutge.org, it will be skipped.
73
+ Valid users will be have the problem passcode added to their account and will receive an information email.
74
+ `,
75
+ )
76
+
77
+ .argument('<emails...>', 'emails to share the passcode with')
78
+ .option('-d, --directory <directory>', 'problem directory', '.')
79
+ .option('-t --text <text>', 'additional text message to include in the email', '')
80
+
81
+ .action(async (emails, { directory, text }) => {
82
+ await shareWith(directory, emails, text)
83
+ })