## Running cookbooks with Instructor Hub tool

Welcome to Instructor cookbooks. The goal of this section is to provide a set of tutorials and examples to help you get started.



## CLI Usage

Instructor comes with a CLI tool that allows you to view and interact with the tutorials and examples and allows you to find the code snippets you may need to get solution to your problem.



### List Cookbooks

Run `./hub.sh list` you can see all the available tutorials and examples.

```bash
$ ./hub.sh list
```
...or on Windows:

```cli
$ ./hub.bat list
```

### Reading a Cookbook

To read a tutorial, you can run `./hub.sh show {id}` to see the full tutorial in the terminal.

```bash
$ ./hub.sh show {name or id}
```

Currently, there is no way to page through the tutorial - feel free to contribute :)


### Running a Cookbook

To run a tutorial, you run `./hub.sh run {id}` in terminal - it will execute the code and show the output. You need to have your OPENAI_API_KEY set in your environment (.env file in root directory of your copy of instructor-php repo). 

```bash
$ ./hub.sh run {name or id}
```


### Running all Cookbooks

This is mostly for testing if cookbooks are executed properly, but you can run `./hub.sh all {id}` to run all the tutorials and examples in the terminal.

```bash
$ ./hub.sh all {name or id}
```

