lscontests 2.2.3 → 2.4.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 +117 -167
- package/dist/cli.d.ts +6 -3
- package/dist/cli.js +34 -38
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +16 -20
- package/dist/index.js +100 -99
- package/dist/index.js.map +1 -1
- package/dist/lib/contest.d.ts +2 -2
- package/dist/lib/oj/atcoder.d.ts +2 -2
- package/dist/lib/oj/atcoder.js +2 -25
- package/dist/lib/oj/atcoder.js.map +1 -1
- package/dist/lib/oj/codeforces.d.ts +2 -2
- package/dist/lib/oj/codeforces.js +2 -25
- package/dist/lib/oj/codeforces.js.map +1 -1
- package/dist/lib/oj/index.d.ts +6 -6
- package/dist/lib/oj/index.js.map +1 -1
- package/dist/lib/oj/leetcode.d.ts +2 -2
- package/dist/lib/oj/leetcode.js +2 -25
- package/dist/lib/oj/leetcode.js.map +1 -1
- package/dist/lib/oj/luogu.d.ts +2 -2
- package/dist/lib/oj/nowcoder.d.ts +2 -2
- package/dist/lib/oj/nowcoder.js +3 -26
- package/dist/lib/oj/nowcoder.js.map +1 -1
- package/dist/locale/en.json +3 -3
- package/dist/locale/zh-CN.json +3 -3
- package/dist/locale/zh-NE.json +3 -3
- package/dist/locale/zh-TW.json +3 -3
- package/dist/server.js +20 -4
- package/dist/server.js.map +1 -1
- package/package.json +12 -18
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,7 +56,7 @@ 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
|
|
59
|
+
(*The following content was automatically generated using [semantic-release](https://github.com/semantic-release/semantic-release) on Mon, 13 Jun 2022 05:05:09 GMT*)
|
|
59
60
|
|
|
60
61
|
<details>
|
|
61
62
|
<summary> <code>> lsct -L en</code> </summary>
|
|
@@ -64,62 +65,20 @@ It performs as follows:
|
|
|
64
65
|
There are 1 contests is running on NowCoder
|
|
65
66
|
|
|
66
67
|
OJ: NowCoder
|
|
67
|
-
Contest name:
|
|
68
|
+
Contest name: 牛客竞赛计算几何专题班扫描线
|
|
68
69
|
Rule: ICPC
|
|
69
|
-
Start time:
|
|
70
|
-
End time:
|
|
71
|
-
https://ac.nowcoder.com/acm/contest/
|
|
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
|
|
72
73
|
|
|
73
|
-
There are
|
|
74
|
+
There are 1 contests on Codeforces in the next 3 days
|
|
74
75
|
|
|
75
|
-
OJ:
|
|
76
|
-
Contest name:
|
|
77
|
-
Rule: ICPC
|
|
78
|
-
Start time: 5/27/2022, 11:00:00
|
|
79
|
-
End time: 5/27/2022, 13:30:00
|
|
80
|
-
https://ac.nowcoder.com/acm/contest/34330
|
|
81
|
-
|
|
82
|
-
OJ: AtCoder
|
|
83
|
-
Contest name: Ⓗ AtCoder Heuristic Contest 011
|
|
84
|
-
Rule: AtCoder
|
|
85
|
-
Start time: 5/28/2022, 03:00:00
|
|
86
|
-
End time: 6/5/2022, 10:00:00
|
|
87
|
-
https://atcoder.jp/contests/ahc011
|
|
88
|
-
|
|
89
|
-
OJ: NowCoder
|
|
90
|
-
Contest name: MINIEYE 杯第十六届华中科技大学程序设计邀请赛
|
|
91
|
-
Rule: ICPC
|
|
92
|
-
Start time: 5/28/2022, 04:30:00
|
|
93
|
-
End time: 5/28/2022, 09:30:00
|
|
94
|
-
https://ac.nowcoder.com/acm/contest/34866
|
|
95
|
-
|
|
96
|
-
OJ: NowCoder
|
|
97
|
-
Contest name: 福建农林大学校赛(同步赛)
|
|
76
|
+
OJ: Codeforces
|
|
77
|
+
Contest name: Codeforces Round #799 (Div. 4)
|
|
98
78
|
Rule: ICPC
|
|
99
|
-
Start time:
|
|
100
|
-
End time:
|
|
101
|
-
https://
|
|
102
|
-
|
|
103
|
-
OJ: AtCoder
|
|
104
|
-
Contest name: Ⓐ NOMURA Programming Contest 2022(AtCoder Beginner Contest 253)
|
|
105
|
-
Rule: AtCoder
|
|
106
|
-
Start time: 5/28/2022, 12:00:00
|
|
107
|
-
End time: 5/28/2022, 13:40:00
|
|
108
|
-
https://atcoder.jp/contests/abc253
|
|
109
|
-
|
|
110
|
-
OJ: LeetCode
|
|
111
|
-
Contest name: Biweekly Contest 79
|
|
112
|
-
Rule: AtCoder
|
|
113
|
-
Start time: 5/28/2022, 14:30:00
|
|
114
|
-
End time: 5/28/2022, 16:00:00
|
|
115
|
-
https://leetcode.com/contest/biweekly-contest-79
|
|
116
|
-
|
|
117
|
-
OJ: LeetCode
|
|
118
|
-
Contest name: Weekly Contest 295
|
|
119
|
-
Rule: AtCoder
|
|
120
|
-
Start time: 5/29/2022, 02:30:00
|
|
121
|
-
End time: 5/29/2022, 04:00:00
|
|
122
|
-
https://leetcode.com/contest/weekly-contest-295
|
|
79
|
+
Start time: 6/14/2022, 14:35:00
|
|
80
|
+
End time: 6/14/2022, 16:50:00
|
|
81
|
+
https://codeforces.com/contests/1692
|
|
123
82
|
```
|
|
124
83
|
|
|
125
84
|
</details>
|
|
@@ -128,37 +87,51 @@ https://leetcode.com/contest/weekly-contest-295
|
|
|
128
87
|
<summary> <code>> lsct -o at cf -d 7 -L en</code> </summary>
|
|
129
88
|
|
|
130
89
|
```text
|
|
131
|
-
|
|
90
|
+
There are no running contests on AtCoder,Codeforces
|
|
132
91
|
|
|
133
|
-
There are
|
|
92
|
+
There are 6 contests on Codeforces,AtCoder in the next 7 days
|
|
134
93
|
|
|
135
|
-
OJ:
|
|
136
|
-
Contest name:
|
|
137
|
-
Rule:
|
|
138
|
-
Start time:
|
|
139
|
-
End time: 6/
|
|
140
|
-
https://
|
|
94
|
+
OJ: Codeforces
|
|
95
|
+
Contest name: Codeforces Round #799 (Div. 4)
|
|
96
|
+
Rule: ICPC
|
|
97
|
+
Start time: 6/14/2022, 14:35:00
|
|
98
|
+
End time: 6/14/2022, 16:50:00
|
|
99
|
+
https://codeforces.com/contests/1692
|
|
141
100
|
|
|
142
|
-
OJ:
|
|
143
|
-
Contest name:
|
|
144
|
-
Rule:
|
|
145
|
-
Start time:
|
|
146
|
-
End time:
|
|
147
|
-
https://
|
|
101
|
+
OJ: Codeforces
|
|
102
|
+
Contest name: Codeforces Round #800 (Div. 1)
|
|
103
|
+
Rule: Codeforces
|
|
104
|
+
Start time: 6/16/2022, 14:35:00
|
|
105
|
+
End time: 6/16/2022, 16:35:00
|
|
106
|
+
https://codeforces.com/contests/1693
|
|
107
|
+
|
|
108
|
+
OJ: Codeforces
|
|
109
|
+
Contest name: Codeforces Round #800 (Div. 2)
|
|
110
|
+
Rule: Codeforces
|
|
111
|
+
Start time: 6/16/2022, 14:35:00
|
|
112
|
+
End time: 6/16/2022, 16:35:00
|
|
113
|
+
https://codeforces.com/contests/1694
|
|
148
114
|
|
|
149
115
|
OJ: AtCoder
|
|
150
|
-
Contest name: Ⓐ AtCoder
|
|
116
|
+
Contest name: Ⓐ Tokio Marine & Nichido Fire Insurance Programming Contest 2022(AtCoder Beginner Contest 256)
|
|
151
117
|
Rule: AtCoder
|
|
152
|
-
Start time:
|
|
153
|
-
End time:
|
|
154
|
-
https://atcoder.jp/contests/
|
|
118
|
+
Start time: 6/18/2022, 12:00:00
|
|
119
|
+
End time: 6/18/2022, 13:40:00
|
|
120
|
+
https://atcoder.jp/contests/abc256
|
|
155
121
|
|
|
156
122
|
OJ: Codeforces
|
|
157
|
-
Contest name:
|
|
123
|
+
Contest name: Codeforces Round #TBA (Div. 2)
|
|
158
124
|
Rule: Codeforces
|
|
159
|
-
Start time:
|
|
160
|
-
End time:
|
|
161
|
-
https://codeforces.com/contests/
|
|
125
|
+
Start time: 6/18/2022, 14:35:00
|
|
126
|
+
End time: 6/18/2022, 16:35:00
|
|
127
|
+
https://codeforces.com/contests/1695
|
|
128
|
+
|
|
129
|
+
OJ: AtCoder
|
|
130
|
+
Contest name: Ⓐ AtCoder Regular Contest 142
|
|
131
|
+
Rule: AtCoder
|
|
132
|
+
Start time: 6/19/2022, 12:00:00
|
|
133
|
+
End time: 6/19/2022, 14:00:00
|
|
134
|
+
https://atcoder.jp/contests/arc142
|
|
162
135
|
```
|
|
163
136
|
|
|
164
137
|
</details>
|
|
@@ -172,99 +145,91 @@ https://codeforces.com/contests/1691
|
|
|
172
145
|
"upcoming": [
|
|
173
146
|
{
|
|
174
147
|
"ojName": "AtCoder",
|
|
175
|
-
"name": "
|
|
148
|
+
"name": "Ⓐ Tokio Marine & Nichido Fire Insurance Programming Contest 2022(AtCoder Beginner Contest 256)",
|
|
176
149
|
"rule": "AtCoder",
|
|
177
|
-
"startTime": "2022-
|
|
178
|
-
"endTime": "2022-06-
|
|
179
|
-
"url": "https://atcoder.jp/contests/
|
|
150
|
+
"startTime": "2022-06-18T12:00:00.000Z",
|
|
151
|
+
"endTime": "2022-06-18T13:40:00.000Z",
|
|
152
|
+
"url": "https://atcoder.jp/contests/abc256"
|
|
180
153
|
},
|
|
181
154
|
{
|
|
182
155
|
"ojName": "AtCoder",
|
|
183
|
-
"name": "Ⓐ
|
|
156
|
+
"name": "Ⓐ AtCoder Regular Contest 142",
|
|
184
157
|
"rule": "AtCoder",
|
|
185
|
-
"startTime": "2022-
|
|
186
|
-
"endTime": "2022-
|
|
187
|
-
"url": "https://atcoder.jp/contests/
|
|
158
|
+
"startTime": "2022-06-19T12:00:00.000Z",
|
|
159
|
+
"endTime": "2022-06-19T14:00:00.000Z",
|
|
160
|
+
"url": "https://atcoder.jp/contests/arc142"
|
|
188
161
|
},
|
|
189
162
|
{
|
|
190
163
|
"ojName": "AtCoder",
|
|
191
|
-
"name": "Ⓐ AtCoder
|
|
164
|
+
"name": "Ⓐ NS Solutions Corporation Programming Contest 2022(AtCoder Beginner Contest 257)",
|
|
192
165
|
"rule": "AtCoder",
|
|
193
|
-
"startTime": "2022-
|
|
194
|
-
"endTime": "2022-
|
|
195
|
-
"url": "https://atcoder.jp/contests/
|
|
166
|
+
"startTime": "2022-06-25T12:00:00.000Z",
|
|
167
|
+
"endTime": "2022-06-25T13:40:00.000Z",
|
|
168
|
+
"url": "https://atcoder.jp/contests/abc257"
|
|
196
169
|
},
|
|
197
170
|
{
|
|
198
171
|
"ojName": "AtCoder",
|
|
199
|
-
"name": "Ⓐ AtCoder
|
|
172
|
+
"name": "Ⓐ AtCoder Regular Contest 143",
|
|
200
173
|
"rule": "AtCoder",
|
|
201
|
-
"startTime": "2022-06-
|
|
202
|
-
"endTime": "2022-06-
|
|
203
|
-
"url": "https://atcoder.jp/contests/
|
|
174
|
+
"startTime": "2022-06-26T12:00:00.000Z",
|
|
175
|
+
"endTime": "2022-06-26T14:00:00.000Z",
|
|
176
|
+
"url": "https://atcoder.jp/contests/arc143"
|
|
204
177
|
},
|
|
205
178
|
{
|
|
206
179
|
"ojName": "AtCoder",
|
|
207
|
-
"name": "Ⓐ
|
|
180
|
+
"name": "Ⓐ AtCoder Beginner Contest 258",
|
|
208
181
|
"rule": "AtCoder",
|
|
209
|
-
"startTime": "2022-
|
|
210
|
-
"endTime": "2022-
|
|
211
|
-
"url": "https://atcoder.jp/contests/
|
|
182
|
+
"startTime": "2022-07-02T12:00:00.000Z",
|
|
183
|
+
"endTime": "2022-07-02T13:40:00.000Z",
|
|
184
|
+
"url": "https://atcoder.jp/contests/abc258"
|
|
212
185
|
},
|
|
213
186
|
{
|
|
214
187
|
"ojName": "AtCoder",
|
|
215
|
-
"name": "
|
|
188
|
+
"name": "Ⓗ AtCoder Heuristic Contest 012",
|
|
216
189
|
"rule": "AtCoder",
|
|
217
|
-
"startTime": "2022-
|
|
218
|
-
"endTime": "2022-
|
|
219
|
-
"url": "https://atcoder.jp/contests/
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
"ojName": "AtCoder",
|
|
223
|
-
"name": "Ⓐ AtCoder Regular Contest 143",
|
|
224
|
-
"rule": "AtCoder",
|
|
225
|
-
"startTime": "2022-06-26T12:00:00.000Z",
|
|
226
|
-
"endTime": "2022-06-26T14:00:00.000Z",
|
|
227
|
-
"url": "https://atcoder.jp/contests/arc143"
|
|
190
|
+
"startTime": "2022-07-03T06:00:00.000Z",
|
|
191
|
+
"endTime": "2022-07-03T10:00:00.000Z",
|
|
192
|
+
"url": "https://atcoder.jp/contests/ahc012"
|
|
228
193
|
},
|
|
229
194
|
{
|
|
230
195
|
"ojName": "Codeforces",
|
|
231
|
-
"name": "
|
|
232
|
-
"rule": "
|
|
233
|
-
"startTime": "2022-
|
|
234
|
-
"endTime": "2022-
|
|
235
|
-
"url": "https://codeforces.com/contests/
|
|
196
|
+
"name": "Codeforces Round #799 (Div. 4)",
|
|
197
|
+
"rule": "ICPC",
|
|
198
|
+
"startTime": "2022-06-14T14:35:00.000Z",
|
|
199
|
+
"endTime": "2022-06-14T16:50:00.000Z",
|
|
200
|
+
"url": "https://codeforces.com/contests/1692"
|
|
236
201
|
},
|
|
237
202
|
{
|
|
238
203
|
"ojName": "Codeforces",
|
|
239
|
-
"name": "Codeforces Round #
|
|
204
|
+
"name": "Codeforces Round #800 (Div. 1)",
|
|
240
205
|
"rule": "Codeforces",
|
|
241
|
-
"startTime": "2022-06-
|
|
242
|
-
"endTime": "2022-06-
|
|
243
|
-
"url": "https://codeforces.com/contests/
|
|
206
|
+
"startTime": "2022-06-16T14:35:00.000Z",
|
|
207
|
+
"endTime": "2022-06-16T16:35:00.000Z",
|
|
208
|
+
"url": "https://codeforces.com/contests/1693"
|
|
244
209
|
},
|
|
245
210
|
{
|
|
246
211
|
"ojName": "Codeforces",
|
|
247
|
-
"name": "Codeforces Round #
|
|
212
|
+
"name": "Codeforces Round #800 (Div. 2)",
|
|
248
213
|
"rule": "Codeforces",
|
|
249
|
-
"startTime": "2022-06-
|
|
250
|
-
"endTime": "2022-06-
|
|
251
|
-
"url": "https://codeforces.com/contests/
|
|
214
|
+
"startTime": "2022-06-16T14:35:00.000Z",
|
|
215
|
+
"endTime": "2022-06-16T16:35:00.000Z",
|
|
216
|
+
"url": "https://codeforces.com/contests/1694"
|
|
252
217
|
},
|
|
253
218
|
{
|
|
254
219
|
"ojName": "Codeforces",
|
|
255
|
-
"name": "Codeforces Round #
|
|
256
|
-
"rule": "
|
|
257
|
-
"startTime": "2022-06-
|
|
258
|
-
"endTime": "2022-06-
|
|
259
|
-
"url": "https://codeforces.com/contests/
|
|
220
|
+
"name": "Codeforces Round #TBA (Div. 2)",
|
|
221
|
+
"rule": "Codeforces",
|
|
222
|
+
"startTime": "2022-06-18T14:35:00.000Z",
|
|
223
|
+
"endTime": "2022-06-18T16:35:00.000Z",
|
|
224
|
+
"url": "https://codeforces.com/contests/1695"
|
|
260
225
|
},
|
|
261
226
|
{
|
|
262
227
|
"ojName": "Codeforces",
|
|
263
|
-
"name": "Codeforces Round
|
|
228
|
+
"name": "Codeforces Global Round 21",
|
|
264
229
|
"rule": "Codeforces",
|
|
265
|
-
"startTime": "2022-06-
|
|
266
|
-
"endTime": "2022-06-
|
|
267
|
-
"url": "https://codeforces.com/contests/
|
|
230
|
+
"startTime": "2022-06-25T14:35:00.000Z",
|
|
231
|
+
"endTime": "2022-06-25T16:35:00.000Z",
|
|
232
|
+
"url": "https://codeforces.com/contests/1696"
|
|
268
233
|
}
|
|
269
234
|
]
|
|
270
235
|
}
|
|
@@ -275,16 +240,16 @@ https://codeforces.com/contests/1691
|
|
|
275
240
|
|
|
276
241
|
### API
|
|
277
242
|
|
|
278
|
-
For more detailed API documentation, please visit <https://lsct.
|
|
243
|
+
For more detailed API documentation, please visit <https://lsct.stagoh.com>.
|
|
279
244
|
|
|
280
245
|
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:
|
|
281
246
|
|
|
282
247
|
#### Get text for contests information
|
|
283
248
|
|
|
284
249
|
```typescript
|
|
285
|
-
import
|
|
250
|
+
import lsct from "lscontests";
|
|
286
251
|
|
|
287
|
-
|
|
252
|
+
new lsct({ abbrList: ["cf", "lg"] }).getContestsText().then(console.log);
|
|
288
253
|
```
|
|
289
254
|
|
|
290
255
|
This code gives the same result as `lsct -o cf lg`.
|
|
@@ -292,9 +257,9 @@ This code gives the same result as `lsct -o cf lg`.
|
|
|
292
257
|
#### Get list for contests information
|
|
293
258
|
|
|
294
259
|
```typescript
|
|
295
|
-
import
|
|
260
|
+
import lsct from "lscontests";
|
|
296
261
|
|
|
297
|
-
|
|
262
|
+
new lsct({ abbrList: ["cf", "lg"] }).getContests().then(console.log);
|
|
298
263
|
```
|
|
299
264
|
|
|
300
265
|
This code gives the same result as `lsct -r --no-sort`.
|
|
@@ -302,7 +267,7 @@ This code gives the same result as `lsct -r --no-sort`.
|
|
|
302
267
|
#### Add support for other OJ
|
|
303
268
|
|
|
304
269
|
```typescript
|
|
305
|
-
import { addOJ
|
|
270
|
+
import lsct, { addOJ } from "lscontests";
|
|
306
271
|
|
|
307
272
|
addOJ("ts", {
|
|
308
273
|
name: "testOJ", get: async () => [{
|
|
@@ -316,9 +281,9 @@ addOJ("ts", {
|
|
|
316
281
|
});
|
|
317
282
|
|
|
318
283
|
async function main() {
|
|
319
|
-
console.log(await
|
|
284
|
+
console.log(await new lsct({ abbrList: ["cf", "ts"], days: 1 }).getContestsText("en"));
|
|
320
285
|
console.log();
|
|
321
|
-
console.log(await
|
|
286
|
+
console.log(await new lsct({ abbrList: ["at", "ts"], days: 7 }).getContests());
|
|
322
287
|
}
|
|
323
288
|
|
|
324
289
|
main();
|
|
@@ -327,30 +292,23 @@ main();
|
|
|
327
292
|
This code gives the following results:
|
|
328
293
|
|
|
329
294
|
```text
|
|
330
|
-
There are
|
|
331
|
-
|
|
332
|
-
OJ: Codeforces
|
|
333
|
-
Contest name: Educational Codeforces Round 128 (Rated for Div. 2)
|
|
334
|
-
Rule: ICPC
|
|
335
|
-
Start time: 2022/5/13 22:35:00
|
|
336
|
-
End time: 2022/5/14 00:35:00
|
|
337
|
-
https://codeforces.com/contests/1680
|
|
295
|
+
There are 1 contests is running on testOJ
|
|
338
296
|
|
|
339
297
|
OJ: testOJ
|
|
340
298
|
Contest name: testContest
|
|
341
299
|
Rule: ICPC
|
|
342
|
-
Start time: 2022/
|
|
343
|
-
End time: 2022/
|
|
300
|
+
Start time: 2022/6/10 21:43:58
|
|
301
|
+
End time: 2022/6/10 22:43:58
|
|
344
302
|
https://www.test.com
|
|
345
303
|
|
|
346
|
-
There are 1 contests on Codeforces
|
|
304
|
+
There are 1 contests on Codeforces in the next 1 days
|
|
347
305
|
|
|
348
306
|
OJ: Codeforces
|
|
349
|
-
Contest name: Codeforces Round #
|
|
307
|
+
Contest name: Codeforces Round #798 (Div. 2)
|
|
350
308
|
Rule: Codeforces
|
|
351
|
-
Start time: 2022/
|
|
352
|
-
End time: 2022/
|
|
353
|
-
https://codeforces.com/contests/
|
|
309
|
+
Start time: 2022/6/11 00:35:00
|
|
310
|
+
End time: 2022/6/11 02:35:00
|
|
311
|
+
https://codeforces.com/contests/1689
|
|
354
312
|
|
|
355
313
|
{
|
|
356
314
|
running: [
|
|
@@ -358,27 +316,19 @@ https://codeforces.com/contests/1679
|
|
|
358
316
|
ojName: 'testOJ',
|
|
359
317
|
name: 'testContest',
|
|
360
318
|
rule: 'ICPC',
|
|
361
|
-
startTime: 2022-
|
|
362
|
-
endTime: 2022-
|
|
319
|
+
startTime: 2022-06-10T13:44:01.380Z,
|
|
320
|
+
endTime: 2022-06-10T14:44:01.381Z,
|
|
363
321
|
url: 'https://www.test.com'
|
|
364
322
|
}
|
|
365
323
|
],
|
|
366
324
|
upcoming: [
|
|
367
325
|
{
|
|
368
326
|
ojName: 'AtCoder',
|
|
369
|
-
name: 'Ⓐ
|
|
370
|
-
rule: 'AtCoder',
|
|
371
|
-
startTime: 2022-05-14T12:00:00.000Z,
|
|
372
|
-
endTime: 2022-05-14T13:40:00.000Z,
|
|
373
|
-
url: 'https://atcoder.jp/contests/abc251'
|
|
374
|
-
},
|
|
375
|
-
{
|
|
376
|
-
ojName: 'AtCoder',
|
|
377
|
-
name: 'Ⓐ AtCoder Regular Contest 140',
|
|
327
|
+
name: 'Ⓐ Aising Programming Contest 2022(AtCoder Beginner Contest 255)',
|
|
378
328
|
rule: 'AtCoder',
|
|
379
|
-
startTime: 2022-
|
|
380
|
-
endTime: 2022-
|
|
381
|
-
url: 'https://atcoder.jp/contests/
|
|
329
|
+
startTime: 2022-06-11T12:00:00.000Z,
|
|
330
|
+
endTime: 2022-06-11T13:40:00.000Z,
|
|
331
|
+
url: 'https://atcoder.jp/contests/abc255'
|
|
382
332
|
}
|
|
383
333
|
]
|
|
384
334
|
}
|
|
@@ -389,7 +339,7 @@ https://codeforces.com/contests/1679
|
|
|
389
339
|
```typescript
|
|
390
340
|
import { cli } from "lscontests";
|
|
391
341
|
|
|
392
|
-
cli("-o cf -L en"
|
|
342
|
+
cli("-o cf -L en", undefined, console.log);
|
|
393
343
|
```
|
|
394
344
|
|
|
395
345
|
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
|
|
5
|
+
* @param args Arguments
|
|
5
6
|
* @param name Program name
|
|
6
|
-
* @
|
|
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(
|
|
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
|
-
.
|
|
30
|
-
.addOption(new commander_1.Option("-
|
|
31
|
-
.addOption(new commander_1.Option("-
|
|
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
|
|
39
|
+
* @param args Arguments
|
|
39
40
|
* @param name Program name
|
|
40
|
-
* @
|
|
41
|
+
* @param out Output result
|
|
42
|
+
* @param log_level Log level
|
|
43
|
+
* @param log_transport A winston transport instance
|
|
41
44
|
*/
|
|
42
|
-
function cli(
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
|
|
62
|
+
out(JSON.stringify(lodash_1.default.mapValues(oj_1.alloj, val => val.name), null, 2));
|
|
68
63
|
else {
|
|
69
|
-
const
|
|
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
|
-
|
|
73
|
+
out(JSON.stringify(yield lsct.getContests(), null, 2));
|
|
78
74
|
else
|
|
79
|
-
|
|
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()
|
|
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,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}>;
|
|
18
|
-
|
|
19
|
-
|
|
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 {
|
|
23
|
+
export { OJ, addOJ } from "./lib/oj";
|