Separate lib, new problems and script for web
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
# usaco new <name> [io-name] [--url <link>]
|
||||
[[ $# -ge 1 ]] || usage
|
||||
name=""; io=""; url=""
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--url) url="${2:-}"; shift 2 ;;
|
||||
*) if [[ -z "$name" ]]; then name="$1"; elif [[ -z "$io" ]]; then io="$1"; fi; shift ;;
|
||||
esac
|
||||
done
|
||||
[[ -n "$name" ]] || usage
|
||||
io="${io:-$name}"
|
||||
dir="$ROOT/solving/$name"
|
||||
if [[ -d "$dir" || -d "$ROOT/solved/$name" || -d "$ROOT/skipped/$name" ]]; then
|
||||
echo "Error: '$name' already exists" >&2; exit 1
|
||||
fi
|
||||
mkdir -p "$dir"
|
||||
fresh_main "$dir" "$io"
|
||||
touch "$dir/$io.in"
|
||||
[[ -n "$url" ]] && echo "$url" > "$dir/.url"
|
||||
echo "Created solving/$name (io: $io.in / $io.out)"
|
||||
(cd "$dir" && exec ${EDITOR:-nvim} main.cpp)
|
||||
Reference in New Issue
Block a user