Skip to main content

CLI for creating competitive programming problem files

Project description

cp-tool

A command-line interface (CLI) for creating competitive programming problem files.

Installation with pip

To install cp-tool with pip, use the following command:

pip install cptool-py

Installation with nix flakes

To install cp-tool as a nix flake, add the following input to your configuration:

{
  inputs = {
    cp-tool.url = "github:smntic/cp-tool";
  };
}

Then you can install it either through either your NixOS or home-manager configuration.

NixOS

environment.systemPackages = [
  inputs.cp-tool.packages.${pkgs.system}.cptool-py
];

home-manager

home.packages = [
  inputs.cp-tool.packages.${pkgs.system}.cptool-py
];

Configuration

To set up your templates, copy them to ~/.local/share/cp-tool/template.<extension>. Alternatively, you can define a custom template path with the --template-folder argument.

Usage

cpt [args] <commands>

Commands

  • Create a Problem:

    cpt problem <name>
    

    Creates a folder containing a template for the specified problem name.

  • Create a Contest:

    cpt contest <name> <mode>
    

    Available modes:

    • alpha <num_problems> - create <num_problems> problems indexed by A, B, C, ...
    • numeric <num_problems> - create <num_problems> problems indexed by 1, 2, 3, ...
    • custom <problem_indices> - create a custom list of problem indices, separated by spaces.
  • Create or Replace a Template:

    cpt template <problem_names>
    

    Copies your template to create a new file for each problem.

If the names contain spaces or special characters like '(', you can wrap the entire name in quotes, like "Codeforces Round (Div. 2)". CP-tool will automatically handle converting your strings into a nice, terminal-friendly format.

Arguments

  • File Extension:

    -ex=, --extension=
    

    Use this parameter to specify the file extension for the templates and problem files. The extension defaults to .cpp. Other common examples include .c and .py.

  • Template Path:

    -tf=, --template-folder=
    

    Specify the path to a folder containing all your template files. This defaults to the typical "user data directory" of your operating system. See cpt -h for more information.

Automatic Directory Change

To avoid manually changing directories to the newly created folders, you can run the command with:

source cpt <arguments>

Alternatively, you can create an alias in your shell profile to make cpt execute with source automatically:

alias cpt='source cpt'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cptool_py-2.0.3.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cptool_py-2.0.3-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file cptool_py-2.0.3.tar.gz.

File metadata

  • Download URL: cptool_py-2.0.3.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for cptool_py-2.0.3.tar.gz
Algorithm Hash digest
SHA256 7ddc9647bb5fefb8a36fab42d1b1b5e3a15750a4c0bfee3fcb0ec88cf66dc8fc
MD5 2205b1f1f8e2118bfbcff45df6c0e101
BLAKE2b-256 c5254db70decda1f5f5be72acb313e17bbe9b14d6b5e5fc9f7d799c9bbb4960c

See more details on using hashes here.

Provenance

The following attestation bundles were made for cptool_py-2.0.3.tar.gz:

Publisher: publish.yml on smntic/cp-tool

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cptool_py-2.0.3-py3-none-any.whl.

File metadata

  • Download URL: cptool_py-2.0.3-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for cptool_py-2.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 83ee743f4b453403da4de06b41a3ef7fd8623e2cc993b56d1cee742399a9110a
MD5 d2eae6ebe6d3e640e3c631b8ffe3ccc5
BLAKE2b-256 8928b243cb871466c80d2a3237eb0651d2adeb51dee7fdce654a0f8367f55751

See more details on using hashes here.

Provenance

The following attestation bundles were made for cptool_py-2.0.3-py3-none-any.whl:

Publisher: publish.yml on smntic/cp-tool

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page