Command line tools can efficiently automate monotonous and repetitive tasks (such as creating source code files, copying boilerplate code, running code on sample testcases, etc.) and make competitive programming more fun.
There already exist various choices for command line tools in the competitive programming ecosystem like cpb and cf tool. The problem with these tools is they follow the "Flat File Structure" philosophy in which your source code and testcase files are kept in the same folder to improve the speed of manipulating (creating, updating, deleting) them. This approach causes a mess making it hard to navigate between source code files. As changes in testcase are rare, saving a few seconds is manipulating them might not be worth it.
CPPT is a cross-platform command-line tool made specifically to address this issue. It hides all the data required to test your code inside a hidden subfolder (.cppt) so that your folder remains clean and you can focus on writing your source code instead. It also provides you with easy-to-use and fast testcase manipulation commands.
Some of its key features are:-
- Fetch testcase data from an online judge.
- Compile (if applicable) and run source code against predefined or randomly generated testcases.
- Add testcases to run your code in advance or enter the testcase interactively.
- Create a source code file with your saved templates.
- Open the source code automatically in your favorite editor.
CPPT supports the following operating systems:-
- Windows (both cmd and wsl)
CPPT supports the following programming languages:-
To get started, make sure you have python and pip on your system and the competitive companion extension on your browser.
Use the following command to install the tool.
$ pip install cppt
After installing the tool, type the command.
You should see the following help text.
Usage: cppt [OPTIONS] COMMAND [ARGS]... Options: -h, --help Show this message and exit. Commands: compile compile source code config get the location of config file or reset config file create create a task fetch retrieve testcase data from an online judge run run code against testcases tc commands related to testcase data test brute force testing
For more info (with video demos) refer to the documentation.
PS: Thanks sarvjot for testing the tool for Windows (cmd and wsl).