@rhseung/ps-cli 1.0.0 → 1.3.0
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 +60 -7
- package/dist/chunk-BM3ZMA4K.js +65 -0
- package/dist/{chunk-KFQFQJYT.js → chunk-CIG2LEJC.js} +57 -24
- package/dist/commands/config.js +342 -119
- package/dist/commands/fetch.js +13 -13
- package/dist/commands/init.js +438 -0
- package/dist/commands/run.js +14 -16
- package/dist/commands/stats.js +11 -12
- package/dist/commands/submit.js +21 -39
- package/dist/commands/test.js +22 -58
- package/dist/index.js +25 -0
- package/package.json +6 -4
- package/dist/chunk-IJLJBKLK.js +0 -1689
- package/dist/chunk-OOTPZD7O.js +0 -42
package/dist/chunk-OOTPZD7O.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// src/utils/problem-id.ts
|
|
4
|
-
function detectProblemIdFromPath(cwd = process.cwd()) {
|
|
5
|
-
const normalizedPath = cwd.replace(/\\/g, "/");
|
|
6
|
-
const problemsIndex = normalizedPath.indexOf("/problems/");
|
|
7
|
-
if (problemsIndex === -1) {
|
|
8
|
-
return null;
|
|
9
|
-
}
|
|
10
|
-
const afterProblems = normalizedPath.substring(
|
|
11
|
-
problemsIndex + "/problems/".length
|
|
12
|
-
);
|
|
13
|
-
if (!afterProblems) {
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
const firstSegment = afterProblems.split("/")[0];
|
|
17
|
-
if (!firstSegment) {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
const problemId = parseInt(firstSegment, 10);
|
|
21
|
-
if (isNaN(problemId) || problemId <= 0) {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
if (firstSegment !== problemId.toString()) {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
return problemId;
|
|
28
|
-
}
|
|
29
|
-
function getProblemId(args, cwd = process.cwd()) {
|
|
30
|
-
if (args.length > 0 && args[0]) {
|
|
31
|
-
const problemId = parseInt(args[0], 10);
|
|
32
|
-
if (!isNaN(problemId) && problemId > 0) {
|
|
33
|
-
return problemId;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return detectProblemIdFromPath(cwd);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export {
|
|
40
|
-
detectProblemIdFromPath,
|
|
41
|
-
getProblemId
|
|
42
|
-
};
|