feat: add init-config helper

This commit is contained in:
2025-11-14 22:15:10 +01:00
parent 13b3adf2e2
commit 50c74438a8
3 changed files with 85 additions and 5 deletions

View File

@@ -4,6 +4,7 @@
## Key Features
- `init-config` writes a ready-to-edit config template (respecting `--download-root` and `--force` to overwrite).
- `auth` subcommand stores Base64-encoded credentials per profile (passwords are never logged).
- `list-courses` fetches `/users/me`, paginates enrolled courses, infers semester keys, caches the metadata, and prints a concise table.
- `sync` traverses every course folder/file tree, normalizes names, streams downloads to disk, tracks checksums/remote timestamps, and supports `--dry-run` plus `--prune` to delete orphaned files.
@@ -27,6 +28,9 @@
```
3. **First run**:
```bash
# Optionally scaffold a config template (safe no-op if it exists)
cargo run -- init-config --download-root "$HOME/StudIP"
# Store credentials (prompts for username/password by default)
cargo run -- auth
@@ -63,6 +67,7 @@ max_concurrent_downloads = 3 # placeholder for future concurrency control
| Subcommand | Description | Helpful flags |
| --- | --- | --- |
| `init-config` | Write a default config template (fails if config exists unless forced). | `--force`, `--download-root` |
| `auth` | Collect username/password, encode them, and save them to the active profile. | `--non-interactive`, `--username`, `--password` |
| `list-courses` | List cached or freshly fetched courses with semester keys and IDs. | `--refresh` |
| `sync` | Download files for every enrolled course into the local tree. | `--dry-run`, `--prune`, `--since` *(reserved for future API filters)* |