BootCS 代码检查工具 - 在本地验证你的代码是否正确,然后提交到平台评测。
# 1. 安装(只需一次)
curl -fsSL https://raw.githubusercontent.com/bootcs-dev/bootcs-cli/main/scripts/install-docker.sh | bash
# 2. 登录(只需一次)
bootcs login
# 3. 写代码,然后检查
cd ~/my-code/hello
bootcs check cs50/hello
# 4. 全部通过后,提交
bootcs submit cs50/hellocurl -fsSL https://raw.githubusercontent.com/bootcs-dev/bootcs-cli/main/scripts/install-docker.sh | bash需要先安装 Docker Desktop
bootcs --version
# 输出: bootcs 2.0.0首次使用需要登录 GitHub:
bootcs login按提示操作:
- 访问显示的链接
- 输入验证码
- 授权 BootCS
登录成功后,凭证会保存在本地,无需重复登录。
进入你的代码目录,运行检查:
cd ~/projects/hello
bootcs check cs50/hello示例输出:
🔍 Running checks for cs50/hello...
✅ hello.c exists
✅ hello.c compiles
✅ responds to name Emma
✅ responds to name Rodrigo
🎉 Results: 4 passed
# Python 作业(自动检测语言,通常不需要指定)
bootcs check cs50/hello -L python
# 强制重新下载检查脚本
bootcs check cs50/hello -u
# 查看详细日志
bootcs check cs50/hello --log本地检查全部通过后,提交到平台:
bootcs submit cs50/hello系统会显示要提交的文件列表,确认后上传。
# 跳过确认,直接提交
bootcs submit cs50/hello -y| 命令 | 说明 |
|---|---|
bootcs check <slug> |
检查代码 |
bootcs submit <slug> |
提交代码 |
bootcs login |
登录 |
bootcs logout |
登出 |
bootcs whoami |
查看当前用户 |
bootcs --help |
查看帮助 |
Error: Docker is not running
解决: 启动 Docker Desktop 应用。
Error: Could not find checks for 'xxx'
解决:
- 确认 slug 拼写正确(如
cs50/hello) - 确认已登录:
bootcs login
解决:
- 检查网络连接
- 重试:
bootcs login
🔧 高级选项(开发者)
如果你不想使用 Docker,可以用 pip 安装:
pip install git+https://github.com/bootcs-dev/bootcs-cli.git需要自行配置 C/Python/Java 编译环境。
| 变量 | 说明 | 默认值 |
|---|---|---|
BOOTCS_API_URL |
API 地址 | https://api.bootcs.dev |
BOOTCS_CHECKS_PATH |
本地 checks 路径 | - |
git clone https://github.com/bootcs-dev/bootcs-cli.git
cd bootcs-cli
pip install -e ".[dev]"
pytest