cpg

cpg

  • Version: 0.1.0-preview.15

Download, test, and submit competitive programming solutions.

  • Usage: cpg [FLAGS] <SUBCOMMAND>

Global Flags

  • --no-color — Disable colored output.
  • -C --cd <CD> — Change the directory to run in.
  • --remote — Enable remote mode, overriding configuration and environment detection.
  • --no-remote — Disable remote mode, overriding configuration and environment detection.

Flags

  • -h --help — Print help
  • -V --version — Print version

cpg completion

  • Usage: cpg completion <SHELL>

Print a shell completion script to source or save in your shell configuration.

Arguments

  • <SHELL> — Shell to generate completions for.

    Choices: bash, elvish, fish, nu, powershell, zsh

Flags

  • -h --help — Print help

cpg init

  • Usage: cpg init [--from-oj <FROM_OJ>]

Initialize configuration and template directories interactively.

Flags

  • --from-oj <FROM_OJ> — Import [templates] from an oj-prepare configuration file.
  • -h --help — Print help

cpg config

  • Usage: cpg config [FLAGS]

Show configuration information.

Flags

  • --schema — Print the configuration JSON Schema generated from cpg's configuration types.
  • --root — Print only the absolute workspace root.
  • --config-dir — Print only the absolute configuration directory.
  • --cookies-dir — Print only the absolute cookies directory.
  • --oj-venv-dir — Print only the absolute oj virtual environment directory.
  • --workspace-template-dir — Print only the absolute workspace template directory.
  • --problem-template-dir — Print only the absolute problem template directory.
  • --contest-template-dir — Print only the absolute contest template directory.
  • --single-problem-template-dir — Print only the absolute single problem template directory.
  • -h --help — Print help

cpg login

  • Usage: cpg login [--cookie-file <COOKIE_FILE>] [--info] <SERVICE>

Import a Netscape cookie file or inspect the saved session.

Arguments

  • <SERVICE> — Online judge whose session should be imported or inspected.

Flags

  • --cookie-file <COOKIE_FILE> — Netscape-format cookie file to import; required unless --info is given.
  • --info — Verify saved cookies and print the username and profile URL on separate lines.
  • -h --help — Print help

cpg download

  • Usage: cpg download [-d --directory <DIRECTORY>] <URL>
  • Aliases: d

Download sample cases for one problem into a local directory.

Arguments

  • <URL> — Problem URL to download sample cases from.

Flags

  • -d --directory <DIRECTORY> — Directory to save sample cases in.

    Default: test

  • -h --help — Print help

cpg prepare

  • Usage: cpg prepare <URL>
  • Aliases: p

Prepare a workspace for one problem or all problems in a contest.

Arguments

  • <URL> — Problem or contest URL to prepare.

Flags

  • -h --help — Print help

cpg open

  • Usage: cpg open [-n --url-only] [-c --clipboard]
  • Aliases: o

Open the current problem or contest in your browser, or copy its URL in remote mode.

Flags

  • -n --url-only — Print the URL without opening a browser.
  • -c --clipboard — Copy the URL to the clipboard instead of opening a browser.
  • -h --help — Print help

cpg test

  • Usage: cpg test [FLAGS] [FILE] [-- COMMAND]…
  • Aliases: t

Compile and test a solution.

Arguments

  • [FILE] — Source or executable file to compile/run using language configuration.

    Executable files without a matching extension use the executable language.

  • [-- COMMAND]… — Command and arguments after --, passed through unchanged.

Flags

  • -P --profile <PROFILE> — Language preprocessing/compilation/run profile.

  • -v --show-io <SHOW_IO> — Show case input, expected output, and actual output (or interactive transcript). Defaults to always for cases with a missing .out file, otherwise failure.

    Choices: always, failure, never, a, f, n

  • -p --panes <PANES> — I/O layout; interactive outputs shows judge and solution side by side; all is unavailable.

    Choices: none, outputs, all, 1, 2, 3

    Default: none

  • -n --query-numbers — Number lines relative to expected output, or number interactive exchanges from zero.

  • -H --highlight <HIGHLIGHT> — Highlight expected/actual output differences; cannot be used with --interactive.

    Choices: line, word, l, w

  • -d --test-dir <TEST_DIR> — Directory containing .in and .out test files.

    Defaults to the source directory's test subdirectory, or ./test for a direct command.

  • -t --time-limit <TIME_LIMIT> — Wall-clock limit per case, in milliseconds.

  • -m --memory-limit <MEMORY_LIMIT> — Sampled solution and child-process RSS limit, in MiB.

  • -s --strip — Ignore trailing spaces and tabs on each line and whitespace at the end of output.

    Default: false

  • -S --strip-trailing-newline — Ignore trailing CR and LF bytes when comparing outputs, preserving spaces and tabs.

    Default: false

  • -j --jobs <JOBS> — Maximum number of test cases to run concurrently.

    Default: 1

  • -l --ignore-line-ending — Treat CRLF and LF line endings as equal; disable with --no-ignore-line-ending.

    Default: true

  • -f --fast-fail — Stop starting new cases after the first failure; running cases finish.

  • -I --input-path <INPUT_PATH> — Input file to use instead of the default .in files in the test directory, or - for stdin.

    If both --input-path - and --interactive are given, judge will not be used and you must interact with the solution manually.

  • -e --float-error <FLOAT_ERROR> — Allow this nonnegative error when comparing numeric output tokens.

    Nonnumeric tokens must still match exactly. Select the error comparison with --float-error-type. Exponential notation is supported, e.g., 1e-6.

  • --float-error-type <FLOAT_ERROR_TYPE> — Error comparison used with --float-error; both accepts either absolute or relative error.

    Choices: both, absolute, relative, b, a, r

    Default: both

  • -J --judge <JUDGE> — Judge source file, executable file, or shell command.

  • -i --interactive — Connect the solution and judge through stdin/stdout for interactive testing; requires --judge without --input-path -

  • -h --help — Print help

cpg generate

  • Usage: cpg generate [FLAGS] [FILE] [-- COMMAND]…
  • Aliases: g

Generate test inputs or reference answers.

Arguments

  • [FILE] — Source or executable file to compile/run using language configuration.

    Executable files without a matching extension use the executable language.

  • [-- COMMAND]… — Command and arguments after --, passed through unchanged.

Flags

  • -P --profile <PROFILE> — Language preprocessing/compilation/run profile.

  • -d --dir <DIR> — Directory containing generated inputs and answers.

    Default: random

  • -a --answer — Generate missing .out files using a reference solution.

  • -c --count <COUNT> — Number of new test inputs to generate; cannot be combined with --answer.

    Default: 100

  • -j --jobs <JOBS> — Maximum number of generator or reference-solution processes to run concurrently.

    Default: 1

  • -h --help — Print help

cpg submit

  • Usage: cpg submit [FLAGS] <FILE>
  • Aliases: s

Submit a source file.

Arguments

  • <FILE> — Solution source file to submit.

Flags

  • -P --profile <PROFILE> — Language source transformation and submission language profile.
  • -c --clipboard — Copy the source after preprocess and presubmit to the clipboard without submitting.
  • -o --open — Open the submission page in your browser after a successful submission. With --clipboard, open the problem page instead of the submission page so you can paste the copied source. In remote mode, copy the submission URL; cannot be combined with --clipboard.
  • --problem <PROBLEM> — Submit to this problem URL instead of detecting it from the source's .cpg.toml.
  • -l --language <LANGUAGE> — Server language ID, overriding the language configuration.
  • --allow-submit-unchanged-solution — Allow submitting a file identical to its downloaded template.
  • -h --help — Print help

cpg results

  • Usage: cpg results [-i --ui] [-n --limit <LIMIT>]
  • Aliases: r

Show your submissions for the current problem or contest.

Flags

  • -i --ui — Monitor submissions in an interactive terminal UI. Automatically pause after two hours without new submissions or terminal interaction. Press c to switch number keys between opening and copying submission URLs.

  • -n --limit <LIMIT> — Maximum number of recent submissions to display.

    Default: 20

  • -h --help — Print help

cpg list

  • Usage: cpg list [FLAGS]

List downloaded workspaces, contests, or problems.

Flags

  • --workspace — List contests and single problems (default).

  • --contests — List contests.

  • --problems — List single problems.

  • --all-problems — List single problems and problems within contests.

  • -f --format <FORMAT> — Output format: , , , , and ; \t inserts a tab.

    Default: {path}

  • --json — Output with json instead, with specified delimiter.

    Default: false

  • --delimiter <DELIMITER> — Record delimiter: line, null, tab, or a single character.

    Default: line

  • -h --help — Print help