No description
| src | ||
| .editorconfig | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| README.md | ||
Captain
Captain is a simple tool for creating interactive command line lessons.
Usage
Captain makes use of a config.toml file which contains all the exercises for a single lesson. The current progress of the lesson is stored in the state.toml file.
Commands
captain/captain view- View the current problem.captain hint- View the hint for the current problem.captain check- Run the current problem's check. If the check passes, captain will move onto the next problem.captain reset- Reset progress to the first problem.
Creating a config
The config file should contain a success_message which is printed once everything has been completed, and multiple problems like so:
success_message = "Congrats!"
[[problem]]
text = "What colour is the sky?"
hint = "It rhymes with moo"
check_type = "ask"
check = "blue"
Each problem has the following fields:
| Field | Description |
|---|---|
text |
This is shown to the user to explain what to do. |
hint |
This is shown when the user runs captain hint. It should give a bit of help towards the answer. It can be left blank. |
check_type |
See below |
check |
See below |
Checks
There are multiple checks available:
ask- This simply asks the user to type and answer and checks whether it equals whatever is incheck.ask_cmd- This asks the user to type an answer and checks it against the output of the command fromcheck.cmd- This runs the command incheckand checks whether it is successful.