3. $FIGPATH
The $FIGPATH lets you specify a list of directories where Fig Apps (.html and .run files), executables (like .sh, .py, .js files), and schemas for custom CLIs (.fig 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).
Below
$FIGPATH Match Hierarchy shows how Fig delineates between files with the same name but different extensions
Example gives an example directory of files and shows how Fig would parse some example commands
You can quickly update your $FIGPATH in the Settings 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:
CMD.fig
CMD/index.html
Note: This is a folder called "CMD" that contains an index.html file
CMD.run
CMD.html
CMD
This is a file called "CMD" with no extension
CMD.sh
CMD.py
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
If Fig does NOT match ANY file in ANY path in $FIGPATH it will continue to check Installed 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.
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
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
Last updated