# 3. $FIGPATH

The **$FIGPATH** lets you specify a list of directories where **Fig Apps** (.html and [.run](../interactive-runbooks-2) files), **executables** (like .sh, .py, .js files), and **schemas for custom CLIs** ([.fig](../build-a-cli) files) are located.

You can put any of the file types listed above in a directory that is in your $FIGPATH. To render or execute these files, you can simply run `fig file_name` (without the extension).

```bash
fig file_name      # do not pass the extension
```

#### Below

1. **$FIGPATH Match Hierarchy** shows how Fig delineates between files with the same name but different extensions
2. **Example** gives an example directory of files and shows how Fig would parse some example commands

{% hint style="success" %}
You can quickly update your $FIGPATH in the [Settings](../get-started/fig-home/settings) tab of`fig home`&#x20;
{% endhint %}

## $FIGPATH Match Hierarchy

Let's say you ran `fig CMD` in your Terminal.

Fig will loop through each path in your $FIGPATH. It will check if there is a specific file in that path that **matches** the passed command, `CMD`. Fig checks for matches in the specific order below:

1. CM&#x44;**.fig**
2. CM&#x44;**/index.html**
   * Note: This is a folder called "CMD" that contains an index.html file
3. CM&#x44;**.run**
4. CM&#x44;**.html**
5. CMD
   * This is a file called "CMD" with no extension
6. CM&#x44;**.sh**
7. CM&#x44;**.py**
8. CM&#x44;**.js**

### **If there is a match**

**Fig will open that file according to its format**

| **File Extension**                                                                                                         | Fig's Response                                                                                                                                                               |
| -------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **.html**                                                                                                                  | Render the html using: `fig local path/to/CMD.html`                                                                                                                          |
| **.run**                                                                                                                   | Render the [rundown](../interactive-runbooks-2) using:  `fig run path/to/CMD.run`                                                                                            |
| **.fig**                                                                                                                   | <p>Follow the CLI schema in your <code>CMD.fig</code> file. <br>You can learn more about .fig files in the <a href="../build-a-cli">Build a CLI</a> section of the docs.</p> |
| <p><strong>.sh</strong>, <strong>.py</strong>, <strong>.js</strong>, <br>(or files with <strong>no extension</strong>)</p> | Run the file as an executable: `path/to/CMD.sh`                                                                                                                              |

{% hint style="info" %}
**Note:** After a command has been matched, all remaining subcommands, parameters, or other inputs (e.g. **`fig CMD sub1 sub2 --flag abc`**) will be passed in to Fig's response.
{% endhint %}

### **If there is NOT a match**

Fig will run this same process in next path specified in your the $FIGPATH

**If Fig does NOT match ANY file in ANY path in $FIGPATH** it will continue to check [Installed Apps](fig-apps)

## Example

#### Example File Directory

Here is an example list of files in a directory that I have added to my $FIGPATH

* ACME.fig
* ACME.sh
* deploy/index.html
* test/index.js
* forkDB.run
* local.html
* CALENDAR.py
* calendar.js

#### Example Commands

Here are some example commands I could run in my Terminal:

`fig ACME`

* This will select the ACME.fig file and follow the CLI commands and subcommands defined in the .fig file.&#x20;
  * [Here is more information on .fig files](../build-a-cli)
* This would NOT match ACME.sh as .fig ranks higher than .sh

`fig deploy`

* This will render the deploy/index.html file in a Fig window

`fig test`

* This would NOT match the test/index.js file. Fig only matches folders when they contain an index.html file.
* Fig would continue to the next path in the $FIGPATH

`fig local`

* **local** is a command that [Fig Overrides](fig-overrides)
* Therefore: as this this would NOT match local.html

`fig calendar`

* This would match calendar.js
* This would NOT match CALENDAR.py (even though .py ranks higher than .js) as commands are **case sensitive**

`fig calendar new meeting at 2pm this thursday`

* This would match calendar.js (as above) and would pass `new meeting at 2pm this sunday` as an input to the executable

`fig forkDB`&#x20;

* This would render the forkDB.run interactive runbooks in a Fig window

