No description
Find a file
2023-04-17 19:37:00 +01:00
src initial commit 2023-04-17 19:37:00 +01:00
.editorconfig initial commit 2023-04-17 19:37:00 +01:00
.gitignore initial commit 2023-04-17 19:37:00 +01:00
Cargo.lock initial commit 2023-04-17 19:37:00 +01:00
Cargo.toml initial commit 2023-04-17 19:37:00 +01:00
README.md initial commit 2023-04-17 19:37:00 +01:00

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 in check.
  • ask_cmd - This asks the user to type an answer and checks it against the output of the command from check.
  • cmd - This runs the command in check and checks whether it is successful.