SupportCLI tool

Building a CLI Tool

You can organize collections of Fig Scripts into CLI tools.

Building a commandline tool with Fig allows you to invoke scripts without typing fig run and to combine multiple commands into a single tool.


Think about a CLI tool as a "folder" that contains other folders and files. The files correspond to scripts, that can be executed. The folders are subcommands, that can contain more files or folders.

Let's use the aws CLI as an example:


aws s3 cp

  • aws is the top-level command
  • s3 is a subcommand
  • cp is a script

Creating a new CLI Tool

Open the Fig Dashboard, and go to Scripts, then press the "+ CLI Tool" button.


You will be prompted to choose a name for your CLI tool.

Note: This command will be added to your PATH, so make sure to choose a name that does not collide with other CLI tools that you or your team already use.

Once you've chosen a name for your CLI tool, you'll be able to add new subcommands and Scripts.

Adding Subcommands

Add subcommands to give more structure to your CLI tool. You can organize scripts according to the function they perform, for instance, nesting all scripts related to manage your database under a db subcommand.

Navigate to to the subcommand that you want your new subcommand to be nested under. The press the "+ Subcommand" button.


Adding Scripts

Navigate to the subcommand where you want to add a new script. Then press the "+ Script" button.


You'll be prompted to chose a Script from your collection or to create a new one. If you choose an existing script, it will be moved into the CLI tool.