Summary
This proposal adds a new subcommand:
The command copies the source code of a binary target or explicitly specified source file to the system clipboard.
Motivation
As of 2025, AtCoder has made changes that prevent automatic submission.
However, many users still wish to take advantage of cargo compete for project generation and testing, and submit the code manually by pasting it into the browser.
To support such use cases, this subcommand provides a way to quickly copy the code after testing.
Proposed behavior
Accepts similar options to cargo compete submit:
--src to specify the source file explicitly
--no-test to skip running cargo compete test before copying
--manifest-path, --debug, --release, etc.
Runs cargo compete test by default before copying, unless --no-test is specified.
Uses the clipboard crate for cross-platform clipboard support.
Example usage
cargo compete clip a
cargo compete clip abc352-a
cargo compete clip --src src/bin/a.rs --no-test
Notes
I have implemented a working prototype and confirmed that it behaves as expected.
I plan to submit a pull request shortly.
Tests are not included in the initial PR to avoid modifying the main project structure, but could be added later using a temporary project-based testing approach.
Let me know if you'd prefer a different approach or naming.
Summary
This proposal adds a new subcommand:
The command copies the source code of a binary target or explicitly specified source file to the system clipboard.
Motivation
As of 2025, AtCoder has made changes that prevent automatic submission.
However, many users still wish to take advantage of cargo compete for project generation and testing, and submit the code manually by pasting it into the browser.
To support such use cases, this subcommand provides a way to quickly copy the code after testing.
Proposed behavior
Example usage
Notes
Let me know if you'd prefer a different approach or naming.