Fig Docs
  • 🏠Welcome to Fig
  • 👋Get Started
    • Download and Install
    • `fig home`
      • My Apps
      • The Sidebar
      • Settings
    • The Fig App Store
    • Hotkeys
  • 💪Autocomplete
  • 😀The Fig CLI
    • 1. Fig Overrides
    • 2. Fig Aliases
    • 3. $FIGPATH
    • 4. Fig Apps
  • 📖Interactive Runbooks
    • Form Elements
      • Input
      • Textarea
      • Dropdown
      • Checkboxes
      • Buttons
    • Templating & Interpolation
    • Scripting Language (Psilo)
      • Full List of Functions
    • Running Runbooks
    • Full Examples
  • ⚒️ Build your own CLI
    • `fig build`
    • .fig Files
  • 🧰Build your own App
    • Get Started
    • App Lifecycle
    • Key Concepts
      • Running Shell Commands
      • Reading Environment Variables
      • Accessing Files & Saving Data
      • Loading Local Resources
    • Window Managment
      • Setting Window Properties
      • Repositioning the Window
      • Focusing & Blurring the Window
    • Advanced
      • Creating a Pseudo-Terminal Session
  • Other
    • Fig for Teams
    • Security & Privacy
    • FAQ
    • Contact Us
  • Interactive Runbooks
Powered by GitBook
On this page
  • $FIGPATH Match Hierarchy
  • If there is a match
  • If there is NOT a match
  • Example
  1. The Fig CLI

3. $FIGPATH

Previous2. Fig AliasesNext4. Fig Apps

Last updated 4 years ago

The $FIGPATH lets you specify a list of directories where Fig Apps (.html and files), executables (like .sh, .py, .js files), and schemas for custom CLIs ( 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).

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

You can quickly update your $FIGPATH in the tab offig home

$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. CMD.fig

  2. CMD/index.html

    • Note: This is a folder called "CMD" that contains an index.html file

  3. CMD.run

  4. CMD.html

  5. CMD

    • This is a file called "CMD" with no extension

  6. CMD.sh

  7. CMD.py

  8. CMD.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

.fig

.sh, .py, .js, (or files with no extension)

Run the file as an executable: path/to/CMD.sh

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.

If there is NOT a match

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

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.

  • 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

  • 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

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

Render the using: fig run path/to/CMD.run

Follow the CLI schema in your CMD.fig file. You can learn more about .fig files in the section of the docs.

If Fig does NOT match ANY file in ANY path in $FIGPATH it will continue to check

local is a command that

😀
.run
.fig
Settings
Installed Apps
Here is more information on .fig files
Fig Overrides
rundown
Build a CLI