From c5efae17e4310755b9b107a65b9ff1e85bce7c01 Mon Sep 17 00:00:00 2001 From: Adam French Date: Thu, 24 Sep 2026 13:15:32 +0100 Subject: [PATCH] Document cat, copy, and interactive REPL in README Co-Authored-By: Claude Code --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index d94e91f..7f7fb4e 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,32 @@ Opens from inside the problem dir, so the `.in`/`.out` files are right there. ./usaco open diamond-collector # open the saved problem URL in a browser ``` +### Snippets +``` +./usaco cat diamond-collector # print main.cpp to stdout (pipeable) +./usaco cat diam | wl-copy # e.g. pipe it wherever you want +./usaco copy diamond-collector # copy main.cpp to the clipboard (alias: cp) +``` +`copy` auto-detects the clipboard tool: `wl-copy` on Wayland, then `xclip`/`xsel` on X11, and falls back to an OSC52 terminal escape that works even over SSH. + +### Interactive mode +``` +./usaco i # (aliases: interactive, repl) +``` +A REPL that remembers the problem you're working on, so commands drop the name: +``` +usaco [none]> s diamond-collector # select (a bare name/prefix works too) +usaco [diamond-collector:solving]> r # run, test, edit... no name needed +usaco [diamond-collector:solving]> t c # create a test case +usaco [diamond-collector:solving]> e watermelon # giving a name switches to it +usaco [watermelon:solving]> done +usaco [watermelon:solved]> none # clear the selection +usaco [none]> q +``` +REPL-only commands: `s [name]` (select/show), `none`, `push [name]`/`pop`/`stack` (stash the current problem, work on another, come back), `help [cmd]`, `!cmd` (shell command run in the problem dir), `q`. + +The selection persists across sessions in `.current` (cleared automatically if the problem no longer exists); history is in `.usaco_history`. Tab completion works for both commands and problem names. + ### Misc ``` ./usaco template diamond-collector # reset main.cpp from template (old one saved as main.cpp.bak)