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:
@@ -28,18 +28,19 @@
|
||||
# usaco path <name> Print the problem's directory (used by the ucd shell helper)
|
||||
# usaco clean Delete compiled binaries and backups from all problem dirs
|
||||
# usaco sync git pull --rebase (picks up edits made on the website), then push
|
||||
# usaco template <name> Re-copy template.cpp into the problem as main.cpp (backs up old one)
|
||||
# usaco reset <name> Reset the solution: fresh main.cpp from template (STDIO wired up),
|
||||
# delete binary + .out; keeps tests/ and .in (aliases: rm, delete)
|
||||
# usaco reset <name> [-y] Reset the solution: fresh main.cpp from template (STDIO wired up,
|
||||
# old one saved as main.cpp.bak), delete binary + .out; keeps tests/
|
||||
# and .in. Asks first unless -y (aliases: rm, delete, template, tpl)
|
||||
# usaco test create <name> Save a test case: uses the current .in (or lets you paste one),
|
||||
# then asks for the expected output. Stored in tests/N.in + N.out
|
||||
# usaco test <name> [nums...] Build and run every saved test case (or just the given ones),
|
||||
# diff against expected output, show pass/fail
|
||||
#
|
||||
# Short aliases: n=new r=run b=build t=test d=done u=undo sk=skip o=open
|
||||
# l/ls=list st=stats p=path tpl=template e=edit=vim sy=sync
|
||||
# l/ls=list st=stats p=path e=edit=vim sy=sync
|
||||
#
|
||||
# Names may be unique prefixes: 'usaco e diam' finds diamond-collector.
|
||||
# run/build/test take --debug: build with sanitizers (-fsanitize=address,undefined).
|
||||
#
|
||||
# Implementation: each command lives in lib/cmd/<name>.sh; shared helpers in lib/common.sh.
|
||||
|
||||
@@ -68,10 +69,16 @@ case "$cmd" in
|
||||
path|p) cmd=path ;;
|
||||
clean) cmd=clean ;;
|
||||
sync|sy) cmd=sync ;;
|
||||
template|tpl) cmd=template ;;
|
||||
reset|rm|delete) cmd=reset ;;
|
||||
reset|rm|delete|template|tpl) cmd=reset ;;
|
||||
*) usage ;;
|
||||
esac
|
||||
|
||||
# --debug may appear anywhere in the arguments
|
||||
args=()
|
||||
for a in "$@"; do
|
||||
if [[ "$a" == --debug ]]; then export USACO_DEBUG=1; else args+=("$a"); fi
|
||||
done
|
||||
set -- "${args[@]+"${args[@]}"}"
|
||||
|
||||
source "$ROOT/lib/common.sh"
|
||||
source "$ROOT/lib/cmd/$cmd.sh"
|
||||
|
||||
Reference in New Issue
Block a user