Tidy the usaco CLI: prefixes everywhere, LOCAL debug builds, git-based dates

- done/skip/undo accept unique prefixes like every other command
- builds define LOCAL (-I repo root): the template includes debugging.h
  and enables DBG/printV only locally, so main.cpp is submittable as-is
- run/build/test --debug (or USACO_DEBUG=1): ASan/UBSan + _GLIBCXX_DEBUG
- list/stats date problems by git history, not mtimes reset by checkouts
- template/tpl is now an alias of reset (which gains -y); fixes template
  dropping the STDIO line
- run shows <io>.out via detect_io instead of the first *.out
- debugging.h: size_t loop indices (no -Wsign-compare noise)
- zsh completion for i/cat/copy; README covers test, io, reset, --debug
- ignore a.out

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-14 22:39:16 +01:00
co-authored by Claude Opus 5.5
parent 1c647072c5
commit ac66ad6b03
18 changed files with 118 additions and 54 deletions
+9 -3
View File
@@ -24,6 +24,9 @@ _usaco_problems() {
_usaco() {
local -a cmds
cmds=(
'i:interactive mode (REPL with a current problem)'
'interactive:interactive mode (REPL with a current problem)'
'repl:interactive mode (REPL with a current problem)'
'new:create a problem from template'
'n:create a problem from template'
'run:build and run main.cpp'
@@ -42,6 +45,9 @@ _usaco() {
'skip:set aside for later'
'sk:set aside for later'
'io:show or set the freopen io name'
'cat:print main.cpp to stdout'
'copy:copy main.cpp to the clipboard'
'cp:copy main.cpp to the clipboard'
'open:open the saved problem URL'
'o:open the saved problem URL'
'list:list problems by status'
@@ -54,8 +60,8 @@ _usaco() {
'clean:delete binaries and backups'
'sync:pull website edits, push local commits'
'sy:pull website edits, push local commits'
'template:re-copy template.cpp as main.cpp (backs up old)'
'tpl:re-copy template.cpp as main.cpp (backs up old)'
'template:same as reset'
'tpl:same as reset'
'reset:fresh main.cpp from template, delete binary/.out'
'rm:fresh main.cpp from template, delete binary/.out'
'delete:fresh main.cpp from template, delete binary/.out'
@@ -64,7 +70,7 @@ _usaco() {
_describe 'command' cmds
elif (( CURRENT == 3 )); then
case "$words[2]" in
new|n|list|l|ls|stats|st|clean|sync|sy) ;; # no problem-name argument
i|interactive|repl|new|n|list|l|ls|stats|st|clean|sync|sy) ;; # no problem-name argument
test|t)
local -a subs
subs=('create:save a new test case' 'add:save a new test case' 'new:save a new test case')