Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

The CLI, subcommand by subcommand

Running cmetal with no arguments starts watch mode. The subcommands below do one thing and exit — handy for scripting, for jumping to a specific exercise, or for checking progress without entering the loop.

Wherever a subcommand takes <name>, it can be omitted to mean the current exercise — run, hint, solution and diff all accept it.

cmetal init [dir]

Create a self-contained workspace from the curriculum embedded in the binary — no git clone needed. With no argument it creates ./cmetal-workspace. The target must be a new or empty directory: init refuses to touch a directory that already has content.

cmetal init my-cmetal-course
cd my-cmetal-course
cmetal

cmetal run <name>

Compile, run, and verify a single exercise, print the result, and exit.

cmetal run pointers1
cmetal run bitwise2 --compiler clang

Useful when you want to check one exercise without the watch loop taking over.

cmetal hint <name> [--level N]

Print the exercise's hints. With no --level, prints the first; --level N prints the first N. Hints go from gentlest to near-answer — see Hints and solutions.

cmetal hint pointers1
cmetal hint pointers1 --level 3

cmetal solution <name>

Reveal the official solution for an exercise you've already solved. Solutions are stored obfuscated and unlock only once earned, so this works only after the exercise passes.

cmetal solution pointers2

cmetal diff <name>

Show how your working copy differs from the pristine exercise, as a unified diff. Useful after cmetal update reports that an exercise changed upstream while you had edits.

cmetal diff pointers1

cmetal list

List every exercise with its status — solved, pending, or skipped (e.g. "requires gcc" for a compiler-restricted exercise under the wrong compiler). This is the map of where you are.

cmetal list

cmetal verify

Run the full verification pipeline across all exercises and report. This is the same check CI runs; use it to confirm a clean toolchain or after changing compilers.

cmetal verify
cmetal verify --compiler clang

cmetal update

Bring an init-created workspace up to date with the curriculum embedded in the binary (upgrade the binary first: that is how new exercises arrive). Your work is safe: working copies you edited are never overwritten — if their exercise changed upstream, update says so and points you at cmetal diff/cmetal reset — while copies you never touched are refreshed automatically. Interrupted updates are recovered on the next run. In a git checkout, use git pull instead.

cmetal update

cmetal reset [name]

With a name: restore that one exercise's working copy to the pristine version and mark it pending again — other progress is kept. Without: clear ALL progress and restore every pristine exercise into my_exercises/. Either way, reset asks for confirmation before discarding work you have edited (--force skips the prompt). Nothing outside the cmetal workspace is touched.

cmetal reset pointers1   # redo one exercise
cmetal reset             # start over completely

--compiler <gcc|clang>

A global flag, accepted by watch mode and the single-exercise subcommands, that selects the toolchain for the session. Defaults to gcc. See Choosing a compiler.

Interactive keys (watch mode)

Inside watch mode, these keys drive the loop:

KeyAction
nNext exercise
pPrevious exercise
hShow hint (additive)
lList all exercises
rRe-run current exercise
qQuit