Skip to content

Commit b9f2b5e

Browse files
Release/1.0.5 (kyuridenamida#61)
* Update CHANGELOG.md * Update README.md * Update README.md * Update version from 1.0.4 to 1.0.5 * Update README.md
1 parent 0f9c83a commit b9f2b5e

File tree

3 files changed

+144
-2
lines changed

3 files changed

+144
-2
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Change Log
22

3+
## 1.0.5 / 2018-01-06
4+
- [#59](https://github.com/kyuridenamida/atcoder-tools/pull/59) Support user-defined postprocessor commands after code generation.
5+
- [#54](https://github.com/kyuridenamida/atcoder-tools/pull/54) Support constants (MOD/YES/NO) prediction so you can use them in your template.
6+
- [#52](https://github.com/kyuridenamida/atcoder-tools/pull/52) Support codestyle configuration.
7+
- [#50](https://github.com/kyuridenamida/atcoder-tools/pull/50) Add version checker to notify new versions to users.
8+
- [#49](https://github.com/kyuridenamida/atcoder-tools/pull/49) Support "atcoder-tools submit" command.
9+
310
## 1.0.4 / 2018-12-30
411
- Fix a bug that requirements.txt is not found during package installation.
512
- [#44](https://github.com/kyuridenamida/atcoder-tools/pull/44) Implement more parameters for the test script (See PR for details)

README.md

Lines changed: 136 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ Python 3.5 で動作する [AtCoder](http://atcoder.jp/) からサンプル入
1616
`pip3 install atcoder-tools`
1717

1818
## Demo
19-
[![asciicast](https://asciinema.org/a/JG18AGOE2Vw7Tsa3QTM7Y2XX5.svg)](https://asciinema.org/a/JG18AGOE2Vw7Tsa3QTM7Y2XX5)
19+
<a href="https://asciinema.org/a/JG18AGOE2Vw7Tsa3QTM7Y2XX5">
20+
<img src="https://asciinema.org/a/JG18AGOE2Vw7Tsa3QTM7Y2XX5.svg" width=70%>
21+
</a>
2022

2123
## Usage
2224

@@ -28,6 +30,7 @@ Python 3.5 で動作する [AtCoder](http://atcoder.jp/) からサンプル入
2830

2931
- `atcoder-tools gen {contest_id}` コンテスト環境を用意するコマンド
3032
- `atcoder-tools test` カレント・ディレクトリ上に実行ファイルと入出力(in_\*.txt, out_\*.txt)がある状態で実行するとローカルテストを行う
33+
- `atcoder-tools submit` カレント・ディレクトリ上で実行すると対応する問題がサンプルに通る場合ソースコードを提出します。既にAtCoder上にその問題に対する提出がある場合、`-u`を指定しないと提出できないようになっています。
3134

3235
`atcoder-tools gen --help``atcoder-tools gen`の引数の詳細について確認することができます。
3336

@@ -45,6 +48,138 @@ $ atcoder-tools test
4548
$ atcoder-tool gen [contest_id] --without-login
4649
```
4750

51+
### gen の詳細
52+
```$xslt
53+
usage: atcoder-tools gen [-h] [--without-login]
54+
[--workspace WORKSPACE]
55+
[--lang LANG]
56+
[--template TEMPLATE]
57+
[--replacement REPLACEMENT]
58+
[--parallel]
59+
[--save-no-session-cache]
60+
[--config CONFIG]
61+
contest_id
62+
63+
positional arguments:
64+
contest_id Contest ID (e.g. arc001)
65+
66+
optional arguments:
67+
-h, --help show this help message and exit
68+
--without-login Download data without login
69+
--workspace WORKSPACE
70+
Path to workspace's root directory. This script will create files in {WORKSPACE}/{contest_name}/{alphabet}/ e.g. ./your-workspace/arc001/A/
71+
[Default] ${HOME}/atcoder-workspace
72+
--lang LANG Programming language of your template code, cpp or java.
73+
[Default] cpp
74+
--template TEMPLATE File path to your template code
75+
[Default (C++)] /atcodertools/tools/templates/cpp/template_success.cpp
76+
[Default (Java)] /atcodertools/tools/templates/java/template_success.java
77+
--replacement REPLACEMENT
78+
File path to your config file
79+
[Default (C++)] /atcodertools/tools/templates/cpp/template_failure.cpp
80+
[Default (Java)] /atcodertools/tools/templates/java/template_failure.java
81+
--parallel Prepare problem directories asynchronously using multi processors.
82+
--save-no-session-cache
83+
Save no session cache to avoid security risk
84+
--config CONFIG File path to your config file
85+
[Default (Primary)] ${HOME}/.atcodertools.toml
86+
[Default (Secondary)] /atcodertools/tools/atcodertools-default.toml
87+
88+
```
89+
90+
### test の詳細
91+
92+
```$xslt
93+
usage: atcoder-tools test [-h] [--exec EXEC]
94+
[--num NUM]
95+
[--dir DIR]
96+
[--timeout TIMEOUT]
97+
[--knock-out]
98+
99+
optional arguments:
100+
-h, --help show this help message and exit
101+
--exec EXEC, -e EXEC File path to the execution target. [Default] Automatically detected exec file
102+
--num NUM, -n NUM The case number to test (1-origin). All cases are tested if not specified.
103+
--dir DIR, -d DIR Target directory to test. [Default] Current directory
104+
--timeout TIMEOUT, -t TIMEOUT
105+
Timeout for each test cases (sec) [Default] 1
106+
--knock-out, -k Stop execution immediately after any example's failure [Default] False
107+
108+
```
109+
110+
111+
### submit の詳細
112+
113+
```
114+
usage: atcoder-tools submit [-h] [--exec EXEC]
115+
[--dir DIR]
116+
[--timeout TIMEOUT]
117+
[--code CODE]
118+
[--force]
119+
[--save-no-session-cache]
120+
[--unlock-safety]
121+
122+
optional arguments:
123+
-h, --help show this help message and exit
124+
--exec EXEC, -e EXEC File path to the execution target. [Default] Automatically detected exec file
125+
--dir DIR, -d DIR Target directory to test. [Default] Current directory
126+
--timeout TIMEOUT, -t TIMEOUT
127+
Timeout for each test cases (sec) [Default] 1
128+
--code CODE, -c CODE Path to the source code to submit [Default] Code path written in metadata.json
129+
--force, -f Submit the code regardless of the local test result [Default] False
130+
--save-no-session-cache
131+
Save no session cache to avoid security risk
132+
--unlock-safety, -u By default, this script only submits the first code per problem. However, you can remove the safety by this option in order to submit codes twice or more.
133+
134+
```
135+
136+
137+
## 設定ファイルの例
138+
`~/.atcodertools.toml`に以下の設定を保存すると、コードスタイルや、コード生成後に実行するコマンドを指定できます。
139+
140+
以下は、コードスタイルの設定が幅4のスペースインデントで、
141+
問題用ディレクトリ内で毎回`clang-format`を実行して、最後に`CMakeLists.txt`(空)をコンテスト用ディレクトリに生成する場合の`~/.atcodertools.toml`の例です。
142+
143+
```$xslt
144+
[codestyle]
145+
indent_type = 'space' # 'tab' or 'space'
146+
indent_width = 4
147+
148+
[postprocess]
149+
exec_on_each_problem_dir='clang-format -i ./*.cpp'
150+
exec_on_contest_dir='touch CMakeLists.txt'
151+
```
152+
153+
## テンプレートの例
154+
`atcoder-tools gen`コマンドに対し`--template`, `--replacement` でそれぞれ入力形式の推論に成功したときのテンプレート、生成に失敗したときに代わりに生成するソースコードを指定できます。テンプレートエンジンの仕様については[jinja2](http://jinja.pocoo.org/docs/2.10/) の公式ドキュメントを参照してください。テンプレートに渡される変数は以下の通りです。
155+
156+
- **input_part** input用のコード
157+
- **formal_arguments** 型つき引数列
158+
- **actual_arguments** 型なし引数列
159+
160+
- **mod** 問題文中に存在するmodの値
161+
- **yes_str** 問題文中に存在する yes や possible などの真を表しそうな値
162+
- **no_str** 問題文中に存在する no や impossible などの偽を表しそうな値
163+
164+
```
165+
#include <bits/stdc++.h>
166+
using namespace std;
167+
168+
{% if mod is not none %}const int mod = {{ mod }};{% endif %}
169+
{% if yes_str is not none %}const string YES = "{{ yes_str }}";{% endif %}
170+
{% if no_str is not none %}const string NO = "{{ no_str }}";{% endif %}
171+
172+
void solve({{formal_arguments}}){
173+
174+
}
175+
176+
int main(){
177+
{{input_part}}
178+
solve({{actual_arguments}});
179+
return 0;
180+
}
181+
```
182+
48183

49184
## Contribution
50185
気軽にPRを送ってください。
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.0.4"
1+
__version__ = "1.0.5"

0 commit comments

Comments
 (0)