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
+3 -3
View File
@@ -8,7 +8,7 @@ STACK_FILE="$ROOT/.current_stack"
HISTFILE="$ROOT/.usaco_history"
# commands that take a problem name (the selection is injected when you omit it)
WITH_PROBLEM="run build test done undo skip io cat copy edit open path template reset"
WITH_PROBLEM="run build test done undo skip io cat copy edit open path reset"
# commands that take no problem
NO_PROBLEM="list stats clean sync"
# REPL-only words (used for completion and for 'help')
@@ -144,7 +144,7 @@ while :; do
case "$c" in
r) c=run ;; b) c=build ;; t) c=test ;; d) c=done ;; u) c=undo ;; sk) c=skip ;;
e|vim) c=edit ;; o) c=open ;; l|ls) c=list ;; st) c=stats ;; p) c=path ;;
tpl) c=template ;; rm|delete) c=reset ;; cp) c=copy ;; sy) c=sync ;;
tpl|template|rm|delete) c=reset ;; cp) c=copy ;; sy) c=sync ;;
esac
if [[ " $NO_PROBLEM " == *" $c "* ]]; then
@@ -155,7 +155,7 @@ while :; do
if [[ " $WITH_PROBLEM " == *" $c "* ]]; then
# 'test create' keeps its subword first; the name goes after it
pre=(); if [[ "$c" == test && "${args[0]:-}" =~ ^(create|add|new)$ ]]; then pre=("${args[0]}"); args=("${args[@]:1}"); fi
if [[ ${#args[@]} -ge 1 ]]; then # explicit name: use it and switch to it
if [[ ${#args[@]} -ge 1 && "${args[0]}" != -* ]]; then # explicit name: use it and switch to it
n="$(real_name "${args[0]}")" || { find_problem "${args[0]}" >/dev/null || true; continue; }
set_current "$n"; args=("${args[@]:1}")
elif [[ -z "$cur" ]]; then