1
1
# Codeforces Tool
2
2
3
+ [ ![ Github release] ( https://img.shields.io/github/release/xalanq/cf-tool.svg )] ( https://github.com/xalanq/cf-tool/releases )
4
+ [ ![ platform] ( https://img.shields.io/badge/platform-win%20%7C%20osx%20%7C%20linux-blue.svg )] ( https://github.com/xalanq/cf-tool/releases )
3
5
[ ![ Build Status] ( https://travis-ci.org/xalanq/cf-tool.svg?branch=master )] ( https://travis-ci.org/xalanq/cf-tool )
4
6
[ ![ Go Report Card] ( https://goreportcard.com/badge/github.com/xalanq/cf-tool )] ( https://goreportcard.com/report/github.com/xalanq/cf-tool )
5
7
[ ![ Go Version] ( https://img.shields.io/badge/go-%3E%3D1.12-green.svg )] ( https://github.com/golang )
6
8
[ ![ license] ( https://img.shields.io/badge/license-MIT-%23373737.svg )] ( https://raw.githubusercontent.com/xalanq/cf-tool/master/LICENSE )
7
9
8
- Codeforces Tool is written by Golang. ** It does not contain any browser driver** and it can be compiled to ** a binary file** .
10
+ Codeforces Tool is a tool for [ Codeforces] ( https://codeforces.com ) .
11
+
12
+ It's fast, small, cross-platorm and powerful.
9
13
10
14
## Features
11
15
12
- * Submit a code to contest and ** watch status dynamically** .
13
- * List problems statis in a contest.
14
- * Generate problem samples(parallel).
16
+ * Submit a code to a contest.
17
+ * Watch submissions' status dynamically.
18
+ * List problems stats in a contest.
19
+ * Parse problems' samples (parallel).
20
+ * Generate code by templates.
15
21
* Test samples.
16
- * Watch submissions.
17
- * Open page(problem, standing) with default browser.
18
- * Support code templates.
19
- * Cross-platform.
22
+ * Use default web browser to open problem, standing page.
20
23
* Colorful CLI.
21
24
22
- Contributing is always welcome!
25
+ Pull requests are always welcome.
23
26
24
27
![ ] ( ./assets/readme_1.gif )
25
28
26
- ## TODO
27
-
28
- * Support standing.
29
- * Support gym.
30
- * Support problemset.
31
- * Download someone's codes.
32
- * Support russian.
33
- * Scrape problems? I think we need to discuss for it. It's not a technical problem... [ issue #1 ] ( https://github.com/xalanq/cf-tool/issues/1 ) .
34
-
35
- ## Install
29
+ ## Installation
36
30
37
31
You can download the pre-compiled binary file in [ here] ( https://github.com/xalanq/cf-tool/releases ) .
38
32
39
- You can also compile from the source:
33
+ Or you can compile it from the source:
40
34
41
- ```
35
+ ``` plain
42
36
$ git clone https://github.com/xalanq/cf-tool
43
37
$ cd cf-tool
44
38
$ go build -ldflags "-s -w" cf.go
45
39
```
46
40
47
41
## Usage
48
42
49
- ** You should execute ` cf config login ` and ` cf config add ` at first.**
50
-
51
- If you want to compete, the best command is ` cf race 1111 ` , where ` 1111 ` is the contest id.
52
-
53
43
``` plain
54
44
Codeforces Tool (cf). https://github.com/xalanq/cf-tool
55
45
56
- File:
57
- cf will save some data in following files:
58
-
59
- "~/.cfconfig" config file, including username, encrypted password, etc.
60
- "~/.cfsession" session file, including cookies, username, etc.
46
+ You should run "cf config login" and "cf config add" at first.
61
47
62
- "~" is the homedir in your system
48
+ If you want to compete, the best command is "cf race 1111", where "1111" is the contest id.
63
49
64
50
Usage:
65
51
cf config (login | add | default)
@@ -71,43 +57,51 @@ Usage:
71
57
cf test [<filename>]
72
58
cf watch [<contest-id>]
73
59
cf open [<contest-id>] [<problem-id>]
74
- cf hack [<contest-id>]
60
+ cf stand [<contest-id>]
75
61
cf race <contest-id>
76
62
77
63
Examples:
78
- cf config login Config username and password(encrypt) .
79
- cf config add Add template.
64
+ cf config login Config your username and password.
65
+ cf config add Add a template.
80
66
cf config default Set default template.
81
- cf submit Current path must be <contest-id>/<problem-id>/<file.[suffix]>.
82
- If there are multiple files which satisfy above condition, you
83
- have to choose one.
67
+ cf submit Current path must be "<contest-id>/<problem-id>", cf will find which
68
+ file can be submitted.
84
69
cf submit a.cpp
85
70
cf submit 100 a
86
71
cf submit 100 a a.cpp
87
- cf list List current contest or <contest-id> problems' information.
88
- cf parse 100 Parse contest 100, all problems, including samples,
89
- into ./100/<problem-id>.
90
- cf parse 100 a Parse contest 100, problem a, including samples,
91
- into current path.
92
- cf gen Generate default template in current path (name as current path).
93
- cf gen cpp Generate template which alias is cpp in current path (same above).
94
- cf test Compile the source with build config first. Then test all samples.
95
- If there are multiple files, you have to choose one.
96
- cf watch Watch the first 10 submissions.
97
- cf open 1136 a Open page of contest 1136, problem a with default browser.
98
- cf open 1136 Open page of contest 1136 with default browser.
99
- cf hack Open standing page with default browser.
100
- cf race 1136 Race for contest. It will execute 'cf open 1136 a', 'cf open 1136 b',
101
- until 'cf open 1136 e', and 'cf parse 1136' when the contest begins.
72
+ cf list List problems' stats of current contest.
73
+ cf list 1119
74
+ cf parse 100 Parse all problems of contest 100, including samples, into
75
+ "./100/<problem-id>".
76
+ cf parse 100 a Parse problem "a" of contest 100, including samples, into current path.
77
+ cf gen Generate default template into current path.
78
+ cf gen cpp Generate the template which's alias is "cpp" into current path.
79
+ cf test Compile a source which satisfy at least one template's suffix.
80
+ Then test all samples.
81
+ cf watch Watch the first 10 submissionso of current contest.
82
+ cf open 1136 a Use default web browser to open the page of contest 1136, problem a.
83
+ cf open 1136 Use default web browser to open the page of contest 1136.
84
+ cf stand Use default web browser to open the standing page.
85
+ cf race 1136 Count down before contest 1136 begins. Then it will run 'cf open 1136 a',
86
+ 'cf open 1136 b', ..., 'cf open 1136 e', 'cf parse 1136' when the contest
87
+ begins.
102
88
103
89
Notes:
104
90
<problem-id> Could be "a" or "A", case-insensitive.
105
91
<contest-id> Should be a number, you could find it in codeforces contest url.
106
- E.g. 1119 in https://codeforces.com/contest/1119.
92
+ E.g. " 1119" in " https://codeforces.com/contest/1119" .
107
93
<alias> Template's alias.
108
94
95
+ File:
96
+ cf will save some data in following files:
97
+
98
+ "~/.cfconfig" configuration file, including username, encrypted password, etc.
99
+ "~/.cfsession" session file, including cookies, username, etc.
100
+
101
+ "~" is the home directory of current user in your system.
102
+
109
103
Template:
110
- You can insert some placeholders in your template code. When generate a code from a
104
+ You can insert some placeholders in your template code. When generate a code from the
111
105
template, cf will replace all placeholders by following rules:
112
106
113
107
$%U%$ Username
@@ -123,16 +117,18 @@ Command:
123
117
- before_script (execute once)
124
118
- script (execute number of samples times)
125
119
- after_script (execute once)
126
- You can set one of before_script and after_script to empty string,
127
- meaning not executing. You have to run your program in script(standard input/output).
120
+ You could set "before_script" or "after_script" to empty string if you want,
121
+ meaning not executing.
122
+ You have to run your program in "script" with standard input/output (no need to
123
+ redirect).
128
124
129
- You can insert some placeholders in your commands . When execute these commands ,
125
+ You can insert some placeholders in your scripts . When execute a script ,
130
126
cf will replace all placeholders by following rules:
131
127
132
- $%path%$ Path of test file (Excluding $%full%$, e.g. /home/xalanq/)
133
- $%full%$ Full name of test file (e.g. a.cpp)
134
- $%file%$ Name of testing file (Excluding suffix, e.g. a )
135
- $%rand%$ Random string with 8 character (including a-z 0-9)
128
+ $%path%$ Path to source file (Excluding $%full%$, e.g. " /home/xalanq/" )
129
+ $%full%$ Full name of source file (e.g. " a.cpp" )
130
+ $%file%$ Name of source file (Excluding suffix, e.g. "a" )
131
+ $%rand%$ Random string with 8 character (including " a-z" " 0-9" )
136
132
137
133
Options:
138
134
-h --help
0 commit comments