lscontests 2.2.2 → 2.3.1

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 CHANGED
@@ -41,6 +41,7 @@ Options:
41
41
  -d, --days, <day> number of days to display, set to 0 to get all
42
42
  contests infomation (default: "3")
43
43
  -l, --list list all supported OJ and it's abbreviation
44
+ -s, --silent do not print log
44
45
  -o, --oj <ojs...> OJs to display (choices: "at", "cf", "lc", "lg", "nc")
45
46
  -r, --raw print raw contest list
46
47
  -L, --language <lang> set output language (choices: "en", "zh-CN", "zh-NE",
@@ -55,43 +56,22 @@ Options:
55
56
  It performs as follows:
56
57
 
57
58
  <!-- block_cli begin -->
58
- (*The following content was automatically generated using [semantic-release](https://github.com/semantic-release/semantic-release) on Thu, 26 May 2022 09:01:52 GMT*)
59
+ (*The following content was automatically generated using [semantic-release](https://github.com/semantic-release/semantic-release) on Sun, 12 Jun 2022 17:05:44 GMT*)
59
60
 
60
61
  <details>
61
62
  <summary> <code>> lsct -L en</code> </summary>
62
63
 
63
64
  ```text
64
- No running contests
65
+ There are 1 contests is running on NowCoder
65
66
 
66
- There are 4 contests on AtCoder,LeetCode in the next 3 days
67
-
68
- OJ: AtCoder
69
- Contest name: AtCoder Heuristic Contest 011
70
- Rule: AtCoder
71
- Start time: 5/28/2022, 03:00:00
72
- End time: 6/5/2022, 10:00:00
73
- https://atcoder.jp/contests/ahc011
74
-
75
- OJ: AtCoder
76
- Contest name: Ⓐ NOMURA Programming Contest 2022(AtCoder Beginner Contest 253)
77
- Rule: AtCoder
78
- Start time: 5/28/2022, 12:00:00
79
- End time: 5/28/2022, 13:40:00
80
- https://atcoder.jp/contests/abc253
81
-
82
- OJ: LeetCode
83
- Contest name: Biweekly Contest 79
84
- Rule: AtCoder
85
- Start time: 5/28/2022, 14:30:00
86
- End time: 5/28/2022, 16:00:00
87
- https://leetcode.com/contest/biweekly-contest-79
67
+ OJ: NowCoder
68
+ Contest name: 牛客竞赛计算几何专题班扫描线
69
+ Rule: ICPC
70
+ Start time: 6/6/2022, 07:00:00
71
+ End time: 6/30/2022, 08:00:00
72
+ https://ac.nowcoder.com/acm/contest/36088
88
73
 
89
- OJ: LeetCode
90
- Contest name: Weekly Contest 295
91
- Rule: AtCoder
92
- Start time: 5/29/2022, 02:30:00
93
- End time: 5/29/2022, 04:00:00
94
- https://leetcode.com/contest/weekly-contest-295
74
+ No contests on AtCoder,Codeforces,LeetCode,Luogu,NowCoder for the next 3 days
95
75
  ```
96
76
 
97
77
  </details>
@@ -100,37 +80,23 @@ https://leetcode.com/contest/weekly-contest-295
100
80
  <summary> <code>> lsct -o at cf -d 7 -L en</code> </summary>
101
81
 
102
82
  ```text
103
- No running contests
83
+ There are no running contests on AtCoder,Codeforces
104
84
 
105
- There are 4 contests on AtCoder,Codeforces in the next 7 days
85
+ There are 2 contests on AtCoder in the next 7 days
106
86
 
107
87
  OJ: AtCoder
108
- Contest name: AtCoder Heuristic Contest 011
88
+ Contest name: Tokio Marine & Nichido Fire Insurance Programming Contest 2022(AtCoder Beginner Contest 256)
109
89
  Rule: AtCoder
110
- Start time: 5/28/2022, 03:00:00
111
- End time: 6/5/2022, 10:00:00
112
- https://atcoder.jp/contests/ahc011
90
+ Start time: 6/18/2022, 12:00:00
91
+ End time: 6/18/2022, 13:40:00
92
+ https://atcoder.jp/contests/abc256
113
93
 
114
94
  OJ: AtCoder
115
- Contest name: Ⓐ NOMURA Programming Contest 2022(AtCoder Beginner Contest 253)
95
+ Contest name: Ⓐ AtCoder Regular Contest 142
116
96
  Rule: AtCoder
117
- Start time: 5/28/2022, 12:00:00
118
- End time: 5/28/2022, 13:40:00
119
- https://atcoder.jp/contests/abc253
120
-
121
- OJ: AtCoder
122
- Contest name: Ⓐ AtCoder Regular Contest 141
123
- Rule: AtCoder
124
- Start time: 5/29/2022, 12:00:00
125
- End time: 5/29/2022, 14:00:00
126
- https://atcoder.jp/contests/arc141
127
-
128
- OJ: Codeforces
129
- Contest name: CodeCraft-22 and Codeforces Round #795 (Div. 2)
130
- Rule: Codeforces
131
- Start time: 5/31/2022, 14:35:00
132
- End time: 5/31/2022, 16:35:00
133
- https://codeforces.com/contests/1691
97
+ Start time: 6/19/2022, 12:00:00
98
+ End time: 6/19/2022, 14:00:00
99
+ https://atcoder.jp/contests/arc142
134
100
  ```
135
101
 
136
102
  </details>
@@ -144,43 +110,11 @@ https://codeforces.com/contests/1691
144
110
  "upcoming": [
145
111
  {
146
112
  "ojName": "AtCoder",
147
- "name": " AtCoder Heuristic Contest 011",
113
+ "name": " Tokio Marine & Nichido Fire Insurance Programming Contest 2022(AtCoder Beginner Contest 256)",
148
114
  "rule": "AtCoder",
149
- "startTime": "2022-05-28T03:00:00.000Z",
150
- "endTime": "2022-06-05T10:00:00.000Z",
151
- "url": "https://atcoder.jp/contests/ahc011"
152
- },
153
- {
154
- "ojName": "AtCoder",
155
- "name": "Ⓐ NOMURA Programming Contest 2022(AtCoder Beginner Contest 253)",
156
- "rule": "AtCoder",
157
- "startTime": "2022-05-28T12:00:00.000Z",
158
- "endTime": "2022-05-28T13:40:00.000Z",
159
- "url": "https://atcoder.jp/contests/abc253"
160
- },
161
- {
162
- "ojName": "AtCoder",
163
- "name": "Ⓐ AtCoder Regular Contest 141",
164
- "rule": "AtCoder",
165
- "startTime": "2022-05-29T12:00:00.000Z",
166
- "endTime": "2022-05-29T14:00:00.000Z",
167
- "url": "https://atcoder.jp/contests/arc141"
168
- },
169
- {
170
- "ojName": "AtCoder",
171
- "name": "Ⓐ AtCoder Beginner Contest 254",
172
- "rule": "AtCoder",
173
- "startTime": "2022-06-04T12:00:00.000Z",
174
- "endTime": "2022-06-04T13:40:00.000Z",
175
- "url": "https://atcoder.jp/contests/abc254"
176
- },
177
- {
178
- "ojName": "AtCoder",
179
- "name": "Ⓐ Aising Programming Contest 2022(AtCoder Beginner Contest 255)",
180
- "rule": "AtCoder",
181
- "startTime": "2022-06-11T12:00:00.000Z",
182
- "endTime": "2022-06-11T13:40:00.000Z",
183
- "url": "https://atcoder.jp/contests/abc255"
115
+ "startTime": "2022-06-18T12:00:00.000Z",
116
+ "endTime": "2022-06-18T13:40:00.000Z",
117
+ "url": "https://atcoder.jp/contests/abc256"
184
118
  },
185
119
  {
186
120
  "ojName": "AtCoder",
@@ -190,6 +124,14 @@ https://codeforces.com/contests/1691
190
124
  "endTime": "2022-06-19T14:00:00.000Z",
191
125
  "url": "https://atcoder.jp/contests/arc142"
192
126
  },
127
+ {
128
+ "ojName": "AtCoder",
129
+ "name": "Ⓐ NS Solutions Corporation Programming Contest 2022(AtCoder Beginner Contest 257)",
130
+ "rule": "AtCoder",
131
+ "startTime": "2022-06-25T12:00:00.000Z",
132
+ "endTime": "2022-06-25T13:40:00.000Z",
133
+ "url": "https://atcoder.jp/contests/abc257"
134
+ },
193
135
  {
194
136
  "ojName": "AtCoder",
195
137
  "name": "Ⓐ AtCoder Regular Contest 143",
@@ -199,44 +141,20 @@ https://codeforces.com/contests/1691
199
141
  "url": "https://atcoder.jp/contests/arc143"
200
142
  },
201
143
  {
202
- "ojName": "Codeforces",
203
- "name": "CodeCraft-22 and Codeforces Round #795 (Div. 2)",
204
- "rule": "Codeforces",
205
- "startTime": "2022-05-31T14:35:00.000Z",
206
- "endTime": "2022-05-31T16:35:00.000Z",
207
- "url": "https://codeforces.com/contests/1691"
208
- },
209
- {
210
- "ojName": "Codeforces",
211
- "name": "Codeforces Round #796 (Div. 1)",
212
- "rule": "Codeforces",
213
- "startTime": "2022-06-03T14:35:00.000Z",
214
- "endTime": "2022-06-03T16:35:00.000Z",
215
- "url": "https://codeforces.com/contests/1687"
216
- },
217
- {
218
- "ojName": "Codeforces",
219
- "name": "Codeforces Round #796 (Div. 2)",
220
- "rule": "Codeforces",
221
- "startTime": "2022-06-03T14:35:00.000Z",
222
- "endTime": "2022-06-03T16:35:00.000Z",
223
- "url": "https://codeforces.com/contests/1688"
224
- },
225
- {
226
- "ojName": "Codeforces",
227
- "name": "Codeforces Round #797 (Div. 3)",
228
- "rule": "ICPC",
229
- "startTime": "2022-06-07T14:35:00.000Z",
230
- "endTime": "2022-06-07T16:50:00.000Z",
231
- "url": "https://codeforces.com/contests/1690"
144
+ "ojName": "AtCoder",
145
+ "name": " AtCoder Beginner Contest 258",
146
+ "rule": "AtCoder",
147
+ "startTime": "2022-07-02T12:00:00.000Z",
148
+ "endTime": "2022-07-02T13:40:00.000Z",
149
+ "url": "https://atcoder.jp/contests/abc258"
232
150
  },
233
151
  {
234
- "ojName": "Codeforces",
235
- "name": "Codeforces Round #798 (Div. 2)",
236
- "rule": "Codeforces",
237
- "startTime": "2022-06-10T16:35:00.000Z",
238
- "endTime": "2022-06-10T18:35:00.000Z",
239
- "url": "https://codeforces.com/contests/1689"
152
+ "ojName": "AtCoder",
153
+ "name": " AtCoder Heuristic Contest 012",
154
+ "rule": "AtCoder",
155
+ "startTime": "2022-07-03T06:00:00.000Z",
156
+ "endTime": "2022-07-03T10:00:00.000Z",
157
+ "url": "https://atcoder.jp/contests/ahc012"
240
158
  }
241
159
  ]
242
160
  }
@@ -247,16 +165,16 @@ https://codeforces.com/contests/1691
247
165
 
248
166
  ### API
249
167
 
250
- For more detailed API documentation, please visit <https://lsct.agoh.xyz>.
168
+ For more detailed API documentation, please visit <https://lsct.stagoh.com>.
251
169
 
252
170
  If you want to get a list of contest information in your project by calling *lscontests*, or if you need to add support for other OJs, then you can call the *lscontests* API as follows:
253
171
 
254
172
  #### Get text for contests information
255
173
 
256
174
  ```typescript
257
- import { getContestInfo } from "lscontests";
175
+ import lsct from "lscontests";
258
176
 
259
- getContestsInfoText({ abbrList: ["cf", "lg"] }).then(console.log);
177
+ new lsct({ abbrList: ["cf", "lg"] }).getContestsText().then(console.log);
260
178
  ```
261
179
 
262
180
  This code gives the same result as `lsct -o cf lg`.
@@ -264,9 +182,9 @@ This code gives the same result as `lsct -o cf lg`.
264
182
  #### Get list for contests information
265
183
 
266
184
  ```typescript
267
- import { getContestList } from "lscontests";
185
+ import lsct from "lscontests";
268
186
 
269
- getContests({ sort: false }).then(console.log);
187
+ new lsct({ abbrList: ["cf", "lg"] }).getContests().then(console.log);
270
188
  ```
271
189
 
272
190
  This code gives the same result as `lsct -r --no-sort`.
@@ -274,7 +192,7 @@ This code gives the same result as `lsct -r --no-sort`.
274
192
  #### Add support for other OJ
275
193
 
276
194
  ```typescript
277
- import { addOJ, getContestsInfoText, getContests } from "lscontests";
195
+ import lsct, { addOJ } from "lscontests";
278
196
 
279
197
  addOJ("ts", {
280
198
  name: "testOJ", get: async () => [{
@@ -288,9 +206,9 @@ addOJ("ts", {
288
206
  });
289
207
 
290
208
  async function main() {
291
- console.log(await getContestsInfoText({ abbrList: ["cf", "ts"], days: 1 }, "en"));
209
+ console.log(await new lsct({ abbrList: ["cf", "ts"], days: 1 }).getContestsText("en"));
292
210
  console.log();
293
- console.log(await getContests({ abbrList: ["at", "ts"], days: 7 }));
211
+ console.log(await new lsct({ abbrList: ["at", "ts"], days: 7 }).getContests());
294
212
  }
295
213
 
296
214
  main();
@@ -299,30 +217,23 @@ main();
299
217
  This code gives the following results:
300
218
 
301
219
  ```text
302
- There are 2 contests is running on Codeforces,testOJ
303
-
304
- OJ: Codeforces
305
- Contest name: Educational Codeforces Round 128 (Rated for Div. 2)
306
- Rule: ICPC
307
- Start time: 2022/5/13 22:35:00
308
- End time: 2022/5/14 00:35:00
309
- https://codeforces.com/contests/1680
220
+ There are 1 contests is running on testOJ
310
221
 
311
222
  OJ: testOJ
312
223
  Contest name: testContest
313
224
  Rule: ICPC
314
- Start time: 2022/5/13 23:23:31
315
- End time: 2022/5/14 00:23:31
225
+ Start time: 2022/6/10 21:43:58
226
+ End time: 2022/6/10 22:43:58
316
227
  https://www.test.com
317
228
 
318
- There are 1 contests on Codeforces,testOJ in the next 1 days
229
+ There are 1 contests on Codeforces in the next 1 days
319
230
 
320
231
  OJ: Codeforces
321
- Contest name: Codeforces Round #791 (Div. 2)
232
+ Contest name: Codeforces Round #798 (Div. 2)
322
233
  Rule: Codeforces
323
- Start time: 2022/5/14 17:35:00
324
- End time: 2022/5/14 19:35:00
325
- https://codeforces.com/contests/1679
234
+ Start time: 2022/6/11 00:35:00
235
+ End time: 2022/6/11 02:35:00
236
+ https://codeforces.com/contests/1689
326
237
 
327
238
  {
328
239
  running: [
@@ -330,27 +241,19 @@ https://codeforces.com/contests/1679
330
241
  ojName: 'testOJ',
331
242
  name: 'testContest',
332
243
  rule: 'ICPC',
333
- startTime: 2022-05-13T15:23:37.245Z,
334
- endTime: 2022-05-13T16:23:37.246Z,
244
+ startTime: 2022-06-10T13:44:01.380Z,
245
+ endTime: 2022-06-10T14:44:01.381Z,
335
246
  url: 'https://www.test.com'
336
247
  }
337
248
  ],
338
249
  upcoming: [
339
250
  {
340
251
  ojName: 'AtCoder',
341
- name: 'Ⓐ Panasonic Programming Contest 2022(AtCoder Beginner Contest 251)',
342
- rule: 'AtCoder',
343
- startTime: 2022-05-14T12:00:00.000Z,
344
- endTime: 2022-05-14T13:40:00.000Z,
345
- url: 'https://atcoder.jp/contests/abc251'
346
- },
347
- {
348
- ojName: 'AtCoder',
349
- name: 'Ⓐ AtCoder Regular Contest 140',
252
+ name: 'Ⓐ Aising Programming Contest 2022AtCoder Beginner Contest 255)',
350
253
  rule: 'AtCoder',
351
- startTime: 2022-05-15T12:00:00.000Z,
352
- endTime: 2022-05-15T14:00:00.000Z,
353
- url: 'https://atcoder.jp/contests/arc140'
254
+ startTime: 2022-06-11T12:00:00.000Z,
255
+ endTime: 2022-06-11T13:40:00.000Z,
256
+ url: 'https://atcoder.jp/contests/abc255'
354
257
  }
355
258
  ]
356
259
  }
@@ -361,7 +264,7 @@ https://codeforces.com/contests/1679
361
264
  ```typescript
362
265
  import { cli } from "lscontests";
363
266
 
364
- cli("-o cf -L en").then(console.log);
267
+ cli("-o cf -L en", undefined, console.log);
365
268
  ```
366
269
 
367
270
  This code gives the same result as `lsct -o cf -L en`.
package/dist/cli.d.ts CHANGED
@@ -1,8 +1,11 @@
1
1
  #!/usr/bin/env node
2
+ import winston from "winston";
2
3
  /**
3
4
  * CLI entrypoint
4
- * @param arg Arguments
5
+ * @param args Arguments
5
6
  * @param name Program name
6
- * @returns CLI output content
7
+ * @param out Output result
8
+ * @param log_level Log level
9
+ * @param log_transport A winston transport instance
7
10
  */
8
- export declare function cli(arg?: string, name?: string): Promise<string>;
11
+ export declare function cli(args?: string, name?: string, out?: (msg: string) => void, log_level?: string, log_transport?: winston.transports.ConsoleTransportInstance): Promise<void>;
package/dist/cli.js CHANGED
@@ -14,73 +14,69 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  };
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.cli = void 0;
17
+ const commander_1 = __importDefault(require("commander"));
18
+ const lodash_1 = __importDefault(require("lodash"));
19
+ const winston_1 = __importDefault(require("winston"));
20
+ const _1 = __importDefault(require("."));
17
21
  const package_json_1 = require("../package.json");
18
- const commander_1 = require("commander");
19
22
  const oj_1 = require("./lib/oj");
20
- const _1 = require(".");
21
23
  const locale_1 = require("./locale");
22
- const lodash_1 = __importDefault(require("lodash"));
23
24
  function initCmd() {
24
- return new commander_1.Command()
25
- .name(Object.keys(package_json_1.bin)[0])
25
+ return new commander_1.default.Command()
26
26
  .version(package_json_1.version)
27
27
  .option("-d, --days, <day>", "number of days to display, set to 0 to get all contests infomation", "3")
28
28
  .option("-l, --list", "list all supported OJ and it's abbreviation")
29
- .addOption(new commander_1.Option("-o, --oj <ojs...>", "OJs to display").choices(Object.keys(oj_1.alloj)))
30
- .addOption(new commander_1.Option("-r, --raw", "print raw contest list").conflicts("language"))
31
- .addOption(new commander_1.Option("-L, --language <lang>", "set output language").default("zh-CN").choices(locale_1.langList))
29
+ .option("-s, --silent", "do not print log")
30
+ .addOption(new commander_1.default.Option("-o, --oj <ojs...>", "OJs to display").choices(Object.keys(oj_1.alloj)))
31
+ .addOption(new commander_1.default.Option("-r, --raw", "print raw contest list").conflicts("language"))
32
+ .addOption(new commander_1.default.Option("-L, --language <lang>", "set output language").default("zh-CN").choices(locale_1.langList))
32
33
  .option("--no-sort", "do not sort by contests start time, but by OJ order")
33
34
  .option("--no-running", "do not list all running contests")
34
35
  .option("--no-upcoming", "do not list all upcoming contests");
35
36
  }
36
37
  /**
37
38
  * CLI entrypoint
38
- * @param arg Arguments
39
+ * @param args Arguments
39
40
  * @param name Program name
40
- * @returns CLI output content
41
+ * @param out Output result
42
+ * @param log_level Log level
43
+ * @param log_transport A winston transport instance
41
44
  */
42
- function cli(arg, name) {
45
+ function cli(args, name, out = console.log, log_level = "info", log_transport = winston_1.default.transports.Console) {
43
46
  return __awaiter(this, void 0, void 0, function* () {
44
- const cmd = initCmd();
45
- if (arg === undefined)
46
- cmd.parse();
47
- else {
48
- let msg = "";
49
- try {
50
- if (name)
51
- cmd.name(name);
52
- cmd
53
- .configureOutput({
54
- writeOut: str => msg = str,
55
- writeErr: str => msg = str,
56
- outputError: str => msg = str
57
- })
58
- .exitOverride()
59
- .parse(arg.split(" "), { from: "user" });
60
- }
61
- catch (e) {
62
- return msg;
63
- }
47
+ const cmd = initCmd()
48
+ .name(name !== null && name !== void 0 ? name : Object.keys(package_json_1.bin)[0])
49
+ .configureOutput({
50
+ writeOut: out,
51
+ writeErr: out
52
+ })
53
+ .exitOverride();
54
+ try {
55
+ cmd.parse(args === null || args === void 0 ? void 0 : args.split(" "), { from: "user" });
56
+ }
57
+ catch (e) {
58
+ return;
64
59
  }
65
60
  const opts = cmd.opts();
66
61
  if (opts.list)
67
- return " abbr OJ\n" + JSON.stringify(lodash_1.default.mapValues(oj_1.alloj, val => val.name), null, 2);
62
+ out(JSON.stringify(lodash_1.default.mapValues(oj_1.alloj, val => val.name), null, 2));
68
63
  else {
69
- const config = {
64
+ const lsct = new _1.default({
70
65
  abbrList: lodash_1.default.uniq(opts.oj),
71
66
  days: parseInt(opts.days),
72
67
  sort: opts.sort,
73
68
  running: opts.running,
74
- upcoming: opts.upcoming
75
- };
69
+ upcoming: opts.upcoming,
70
+ silent: opts.silent
71
+ }, log_level, log_transport);
76
72
  if (opts.raw)
77
- return JSON.stringify(yield (0, _1.getContests)(config), null, 2);
73
+ out(JSON.stringify(yield lsct.getContests(), null, 2));
78
74
  else
79
- return yield (0, _1.getContestsInfoText)(config, opts.language);
75
+ out(yield lsct.getContestsText(opts.language));
80
76
  }
81
77
  });
82
78
  }
83
79
  exports.cli = cli;
84
80
  if (require.main === module)
85
- cli().then(console.log);
81
+ cli();
86
82
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,kDAA+C;AAC/C,yCAA4C;AAC5C,iCAAiC;AACjC,wBAA6D;AAC7D,qCAAoC;AACpC,oDAAuB;AAEvB,SAAS,OAAO;IAEZ,OAAO,IAAI,mBAAO,EAAE;SACf,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAG,CAAC,CAAC,CAAC,CAAC,CAAC;SACzB,OAAO,CAAC,sBAAO,CAAC;SAChB,MAAM,CAAC,mBAAmB,EAAE,oEAAoE,EAAE,GAAG,CAAC;SACtG,MAAM,CAAC,YAAY,EAAE,6CAA6C,CAAC;SACnE,SAAS,CAAC,IAAI,kBAAM,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,UAAK,CAAC,CAAC,CAAC;SACxF,SAAS,CAAC,IAAI,kBAAM,CAAC,WAAW,EAAE,wBAAwB,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;SAClF,SAAS,CAAC,IAAI,kBAAM,CAAC,uBAAuB,EAAE,qBAAqB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,iBAAQ,CAAC,CAAC;SACxG,MAAM,CAAC,WAAW,EAAE,qDAAqD,CAAC;SAC1E,MAAM,CAAC,cAAc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AAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;gBACzB,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,MAAM,EAAE,IAAI,CAAC,MAAM;aACtB,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;YAC7B,IAAG,IAAI,CAAC,GAAG;gBAAE,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;;gBAC/D,GAAG,CAAC,MAAM,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;SACvD;IACL,CAAC;CAAA;AAjCD,kBAiCC;AAED,IAAG,OAAO,CAAC,IAAI,KAAK,MAAM;IAAE,GAAG,EAAE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,27 +1,23 @@
1
- import { contest } from "./lib/contest";
2
- export declare type config = {
1
+ import winston from "winston";
2
+ import { Contest } from "./lib/contest";
3
+ export interface LscontestsConfig {
3
4
  abbrList?: string[];
4
5
  days?: number;
5
6
  sort?: boolean;
6
7
  running?: boolean;
7
8
  upcoming?: boolean;
8
- };
9
- /**
10
- * Get the list of all contests matching the given config
11
- * @param config The config of contests that want to get
12
- * @returns A Promise that contains an array of all contests that match the given config
13
- */
14
- export declare function getContests(config?: config): Promise<{
15
- running: contest[];
16
- upcoming: contest[];
17
- }>;
18
- /**
19
- * Get the detailed text of all contests matching the given config
20
- * @param config The config of contests that want to get
21
- * @param language Language of the output text
22
- * @returns A string containing detail text of contests that match the given config
23
- */
24
- export declare function getContestsInfoText(config?: config, language?: string): Promise<string>;
9
+ silent?: boolean;
10
+ }
11
+ export default class Lscontests {
12
+ private config;
13
+ private logger;
14
+ constructor(config?: LscontestsConfig, log_level?: string, log_transport?: winston.transports.ConsoleTransportInstance);
15
+ getContests(): Promise<{
16
+ running: Contest[];
17
+ upcoming: Contest[];
18
+ }>;
19
+ getContestsText(language?: string): Promise<string>;
20
+ }
25
21
  export * from "./lib/contest";
26
22
  export { cli } from "./cli";
27
- export { oj, addOJ } from "./lib/oj";
23
+ export { OJ, addOJ } from "./lib/oj";