A CLI client for PKU's course selection system with auto-enrollment automation.
crates/elective/app_id="elective") → elective SSO endpoint callbacksrc/main.rs — Clap CLI with subcommandssrc/commands.rs — Command implementations including auto-enroll loopsrc/api.rs — HTML scraping, CAPTCHA image extractionsrc/display.rs — Terminal output formattingsrc/client.rs — reqwest client buildersCommandAliasFunctionloginIAAA login (supports --dual for dual-degree students)logout / statusSession managementshowView current course selectionslist``lsBrowse available courses for add/dropsetAdd a course to auto-enroll target listunsetRemove from auto-enroll targetsconfig-captchaConfigure CAPTCHA solver backendlaunchStart auto-enrollment polling loopotpTOTP 2FA management
The config-captcha command supports multiple recognition backends:
manual — Display CAPTCHA image, user inputs answerutool — UTool OCR servicettshitu — TTShiTu recognition APIyunma — Yunma recognition APIbash
# Check session status
info-auth check
# Auto-login (reads credentials from OS keyring, no password needed)
elective login -p # single degree
elective login -p --dual major # dual degree - major
elective login -p --dual minor # dual degree - minor
Note: Dual-degree students MUST specify --dual major or --dual minor, otherwise login will fail with an error.
--dual flag at login for separate sessionanyhow::Result with .context("中文描述")~/.config/info/elective/info_common::credential (keyring → env → interactive)