.fig Files

This page outlines how a .fig file is structured. Thefig build command lets you visually create and edit .fig files. You should not have edit the the actual file.

File Name

Every .fig file must have a name. This name is the root command for all the subcommands defined in .fig file.

e.g. ACME.fig with a subcommand deploy is accessible with fig ACME deploy

File Structure

Every .fig file consists of nested javascript objects with the following properties. Each object is its own CLI command. Any nested objects (nested inside the children property) are considered subcommands of that command.

  • command:

    • the command (or subcommand)

  • text:

    • the rundown that is displayed in a Fig window if a user runs the CLI but passes no inputs

  • script:

    • The shell script to run when the specific command (or subcommand is called)

    • The $SELECTEDPATH variable is used to signify the path the user specified in $FIGPATH

      • You don't have to use $SELECTEDPATH but it lets you share CLI workflows across teams when repos may be in different directories

      • $SELECTEDPATH does not have a trailing slash

      • e.g.

        • python3 my/path/to/deploy.py will work on your computer

        • python3 $SELECTEDPATH/deploy.py will work on your computer and your teammates' so long as you both have added the path to the .fig file to your $FIGPATH

  • runWithNoInput:

    • If true, and the user passes no inputs, parameters or flags to the CLI, Fig will run the script command rather than the opening the runbook defined in the text

  • children

    • The subcommands for the given command

    • An array of objects with the same properties as this object

// File Name: ACME.fig --> ACME is the root command

{
    command: "deploy", // STRING
    
    text: "# Deploy \n ", // STRING
    
    script: "" // STRING
    
    runWithNoInput: true // BOOLEAN
    
    children: [ ] // ARRAY OF OBJECTS 
}

File Location

In order to access the CLI tool, you must add the directory that contains the .fig file to your $FIGPATH. You can do this in Settings.

Last updated