@jutge.org/toolkit 4.2.28 → 4.2.30
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/README.md +5 -0
- package/dist/index.js +348 -345
- package/docs/getting-started-guide.md +1 -0
- package/package.json +1 -1
- package/toolkit/index.ts +2 -0
- package/toolkit/passcode.ts +41 -0
package/package.json
CHANGED
package/toolkit/index.ts
CHANGED
|
@@ -18,6 +18,7 @@ import { makeCmd } from './make'
|
|
|
18
18
|
import { quizCmd } from './quiz'
|
|
19
19
|
import { upgradeCmd } from './upgrade'
|
|
20
20
|
import { uploadCmd } from './upload'
|
|
21
|
+
import { cmdPasscode } from './passcode'
|
|
21
22
|
import { askCmd } from './ask'
|
|
22
23
|
import { convertCmd } from './convert'
|
|
23
24
|
import { stageCmd } from './stage'
|
|
@@ -31,6 +32,7 @@ program.addHelpText('after', '\nMore documentation:\n https://github.com/jutge-
|
|
|
31
32
|
|
|
32
33
|
program.addCommand(makeCmd)
|
|
33
34
|
program.addCommand(uploadCmd)
|
|
35
|
+
program.addCommand(cmdPasscode)
|
|
34
36
|
program.addCommand(cleanCmd)
|
|
35
37
|
program.addCommand(cloneCmd)
|
|
36
38
|
program.addCommand(generateCmd)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Command } from '@commander-js/extra-typings'
|
|
2
|
+
import { removePasscodeInDirectory, setPasscodeInDirectory, showPasscodeInDirectory } from '../lib/passcode'
|
|
3
|
+
|
|
4
|
+
export const cmdPasscode = new Command('passcode')
|
|
5
|
+
.summary('Show, set or remove problem passcode')
|
|
6
|
+
.description(
|
|
7
|
+
`Show, set or remove the passcode of a problem at Jutge.org.
|
|
8
|
+
|
|
9
|
+
These operations require an existing problem.yml file in the problem directory.
|
|
10
|
+
On success, problem.yml is updated with the new passcode (or empty for remove).`,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
cmdPasscode
|
|
15
|
+
.command('show')
|
|
16
|
+
.description('Show the passcode of the problem')
|
|
17
|
+
.option('-d, --directory <directory>', 'problem directory', '.')
|
|
18
|
+
|
|
19
|
+
.action(async ({ directory }) => {
|
|
20
|
+
await showPasscodeInDirectory(directory)
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
cmdPasscode
|
|
24
|
+
.command('set')
|
|
25
|
+
.description('Set or update the passcode of the problem')
|
|
26
|
+
|
|
27
|
+
.option('-d, --directory <directory>', 'problem directory', '.')
|
|
28
|
+
.option('-p, --passcode <passcode>', 'passcode (if omitted, will prompt)')
|
|
29
|
+
|
|
30
|
+
.action(async ({ directory, passcode }) => {
|
|
31
|
+
await setPasscodeInDirectory(directory, passcode)
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
cmdPasscode
|
|
35
|
+
.command('remove')
|
|
36
|
+
.description('Remove the passcode of the problem')
|
|
37
|
+
.option('-d, --directory <directory>', 'problem directory', '.')
|
|
38
|
+
|
|
39
|
+
.action(async ({ directory }) => {
|
|
40
|
+
await removePasscodeInDirectory(directory)
|
|
41
|
+
})
|