Crates.io | tcg |
lib.rs | tcg |
version | 0.1.6 |
source | src |
created_at | 2023-05-16 07:14:22.019621 |
updated_at | 2023-05-20 03:10:34.739668 |
description | Competitive Programming Template Code Generator |
homepage | https://github.com/k4yp/tcg |
repository | https://github.com/k4yp/tcg |
max_upload_size | |
id | 865841 |
size | 14,293 |
Lightweight Rust based command line utility to automate the creation of problem files for competitive programming or practice. It generates problem files based on customs templates.
~/.cargo/bin/
as a PATH variable.The program expects the following command-line arguments:
tcg <name> -t <template>
Optionally provide an input output file
tcg <name> -t <template> -i <input> -o <output>
<name>
: The name of the problem. This will be used to create a directory with the same name to store the problem files.-i, --input
: The input file of the problem solution. You can use %
as a placeholder to be replaced with the problem name.-o, --output
: The output file of your problem solution. You can use %
as a placeholder to be replaced with the problem name.-h, --help
: Print the help screen, which displays the program's usage and available options.To generate problem files for a problem named "example" with the language extension "py", an input file named "example.in", and an output file named "example.out", you would run the following command:
tcg example -t io.py -i %.in -o %.out
This command will create a directory named "example" and generate the necessary problem files inside it.
All template files are customizable. Use %input%
and %output%
as placeholders for input and output files. It will search for these template files in the .config/tcg/templates
directory if you are on linux. Here are some examples
Python
io.py
with open("%input%","r") as f:
case = f.read()
with open("%output%","w") as f:
f.write(case)
cli.py
case = input()
print(case)
This program is licensed under the MIT License.