tcg

Crates.iotcg
lib.rstcg
version0.1.6
sourcesrc
created_at2023-05-16 07:14:22.019621
updated_at2023-05-20 03:10:34.739668
descriptionCompetitive Programming Template Code Generator
homepagehttps://github.com/k4yp/tcg
repositoryhttps://github.com/k4yp/tcg
max_upload_size
id865841
size14,293
kp (k4yp)

documentation

https://docs.rs/crate/tcg/latest

README

Template Code Generator

Generate template code for competitive programming.

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.

Prerequisites

  • Cargo package manager should be installed on your system.
  • Make sure to have ~/.cargo/bin/ as a PATH variable.

Usage

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.

Example

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.

Templates

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)

License

This program is licensed under the MIT License.

Commit count: 12

cargo fmt