lscontests 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -8,10 +8,14 @@
8
8
  ![npm](https://img.shields.io/npm/v/lscontests)
9
9
  ![npm](https://img.shields.io/npm/dw/lscontests)
10
10
 
11
- A CLI tool to get information about the contests on each OJ
11
+ A tool to get information about the contests on each OJ.
12
12
 
13
13
  ## Usage
14
14
 
15
+ ### CLI
16
+
17
+ You can use cli to get a list of contests information easily.
18
+
15
19
  ```bash
16
20
  lsct [options]
17
21
 
@@ -23,6 +27,78 @@ Options:
23
27
  -h, --help display help for command
24
28
  ```
25
29
 
30
+ Its performance:
31
+
32
+ ```bash
33
+ > lsct
34
+ [
35
+ {
36
+ ojName: 'Codeforces',
37
+ name: 'Codeforces Round #790 (Div. 4)',
38
+ rule: 'ICPC',
39
+ startTime: 2022-05-10T14:35:00.000Z,
40
+ endTime: 2022-05-10T16:35:00.000Z,
41
+ url: 'https://codeforces.com/contests/1676'
42
+ },
43
+ {
44
+ ojName: 'NowCoder',
45
+ name: '牛客挑战赛60',
46
+ rule: 'ICPC',
47
+ startTime: 2022-05-13T11:00:00.000Z,
48
+ endTime: 2022-05-13T14:00:00.000Z,
49
+ url: 'https://ac.nowcoder.com/acm/contest/11200'
50
+ }
51
+ ]
52
+ ```
53
+
54
+ ### API
55
+
56
+ If you want to call lscontests in your project to get a list of contests information, or if you need to add OJ support, then you can call the lscontests API like the following:
57
+
58
+ #### Get a list of contests information
59
+
60
+ ```typescript
61
+ import { list } from "lscontests";
62
+
63
+ list().then(console.log);
64
+ ```
65
+
66
+ The result of this code is the same as using cli directly without arguments.
67
+
68
+ #### Add OJ support
69
+
70
+ ```typescript
71
+ import { addOJ, list } from "lscontests";
72
+
73
+ addOJ("ts", {
74
+ name: "testOJ", get: async () => [{
75
+ ojName: "testOJ",
76
+ name: "testContest",
77
+ rule: "ICPC",
78
+ startTime: new Date(Date.now() + 5 * 86400000),
79
+ endTime: new Date(Date.now() + 6 * 86400000),
80
+ url: "https://www.test.com"
81
+ }]
82
+ });
83
+
84
+ list(["ts"], 7).then(console.log);
85
+ ```
86
+
87
+ The result of this code is as follows:
88
+
89
+ ```bash
90
+ [
91
+ {
92
+ ojName: 'testOJ',
93
+ name: 'testContest',
94
+ rule: 'ICPC',
95
+ startTime: 2022-05-15T11:50:42.032Z,
96
+ endTime: 2022-05-16T11:50:42.032Z,
97
+ url: 'https://www.test.com'
98
+ }
99
+ ]
100
+ ```
101
+
26
102
  ## License
27
103
 
28
104
  [GPL-3.0](https://www.gnu.org/licenses/gpl-3.0.html)
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { addOJ } from "./lib/oj";
2
- declare function list(abbrList: string[], days: number): Promise<import("./lib/contest").contest[]>;
2
+ declare function list(abbrList?: string[], days?: number): Promise<import("./lib/contest").contest[]>;
3
3
  export { addOJ, list };
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.list = exports.addOJ = void 0;
13
13
  const oj_1 = require("./lib/oj");
14
14
  Object.defineProperty(exports, "addOJ", { enumerable: true, get: function () { return oj_1.addOJ; } });
15
- function list(abbrList, days) {
15
+ function list(abbrList, days = 3) {
16
16
  return __awaiter(this, void 0, void 0, function* () {
17
17
  if (!abbrList)
18
18
  abbrList = Object.keys(oj_1.alloj);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iCAAwC;AAa/B,sFAbA,UAAK,OAaA;AAXd,SAAe,IAAI,CAAC,QAAkB,EAAE,IAAY;;QAChD,IAAI,CAAC,QAAQ;YAAE,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,UAAK,CAAC,CAAC;QAC7C,OAAO,CAAC,MAAM,OAAO,CAAC,GAAG,CACrB,QAAQ,CAAC,GAAG,CACR,CAAO,IAAI,EAAE,EAAE;YAAC,OAAA,CAA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",
4
4
  "description": "A tool to get information about the contests on each OJ",
5
5
  "keywords": [
6
+ "cli",
7
+ "OJ",
8
+ "Codeforces",
6
9
  "competitive-programming"
7
10
  ],
8
11
  "repository": "https://github.com/StableAgOH/lscontests",