Vibe code scripts to edit and add usaco solutions

This commit is contained in:
2026-08-25 00:45:15 +01:00
parent a79ff12290
commit 6fd6d70b04
26 changed files with 1156 additions and 6 deletions
+55
View File
@@ -0,0 +1,55 @@
# usaco.zsh - zsh integration for the usaco script
# Source this from your ~/.zshrc:
# source ~/Coding/USACO/usaco.zsh
# Provides:
# - tab completion for commands and problem names
# - ucd <name>: cd into a problem's directory
USACO_ROOT="${0:A:h}"
usaco() { "$USACO_ROOT/usaco" "$@"; }
ucd() {
local dir
dir="$("$USACO_ROOT/usaco" path "$1")" || return 1
cd "$dir"
}
_usaco_problems() {
local -a names
names=("$USACO_ROOT"/{solving,solved,skipped}/*(N/:t))
_describe 'problem' names
}
_usaco() {
local -a cmds
cmds=(
'new:create a problem from template'
'run:build and run main.cpp'
'build:build main.cpp'
'vim:open main.cpp in $EDITOR'
'edit:open main.cpp in $EDITOR'
'e:open main.cpp in $EDITOR'
'done:mark solved (auto-commits)'
'undo:move back to solving'
'skip:set aside for later'
'open:open the saved problem URL'
'list:list problems by status'
'stats:show solve counts'
'path:print problem directory'
'clean:delete binaries and backups'
'template:reset main.cpp from template'
)
if (( CURRENT == 2 )); then
_describe 'command' cmds
elif (( CURRENT == 3 )); then
case "$words[2]" in
new|list|stats|clean) ;;
*) _usaco_problems ;;
esac
fi
}
if (( $+functions[compdef] )); then
compdef _usaco usaco
compdef _usaco_problems ucd
fi