Separate lib, new problems and script for web

This commit is contained in:
2026-08-26 22:25:19 +01:00
parent 6fd6d70b04
commit afdab7d4bd
44 changed files with 1060 additions and 211 deletions
+27 -2
View File
@@ -25,28 +25,53 @@ _usaco() {
local -a cmds
cmds=(
'new:create a problem from template'
'n:create a problem from template'
'run:build and run main.cpp'
'r:build and run main.cpp'
'build:build main.cpp'
'b:build main.cpp'
'vim:open main.cpp in $EDITOR'
'edit:open main.cpp in $EDITOR'
'e:open main.cpp in $EDITOR'
'test:run saved test cases (test create <name> to add one)'
't:run saved test cases'
'done:mark solved (auto-commits)'
'd:mark solved (auto-commits)'
'undo:move back to solving'
'u:move back to solving'
'skip:set aside for later'
'sk:set aside for later'
'io:show or set the freopen io name'
'open:open the saved problem URL'
'o:open the saved problem URL'
'list:list problems by status'
'l:list problems by status'
'ls:list problems by status'
'stats:show solve counts'
'st:show solve counts'
'path:print problem directory'
'p:print problem directory'
'clean:delete binaries and backups'
'template:reset main.cpp from template'
'template:re-copy template.cpp as main.cpp (backs up old)'
'tpl:re-copy template.cpp as main.cpp (backs up old)'
'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'
)
if (( CURRENT == 2 )); then
_describe 'command' cmds
elif (( CURRENT == 3 )); then
case "$words[2]" in
new|list|stats|clean) ;;
new|n|list|l|ls|stats|st|clean) ;; # 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')
_describe 'subcommand' subs
_usaco_problems ;;
*) _usaco_problems ;;
esac
elif (( CURRENT == 4 )) && [[ "$words[2]" == (test|t) && "$words[3]" == (create|add|new) ]]; then
_usaco_problems
fi
}
if (( $+functions[compdef] )); then