DocsHow does fig load specs

Loading Specs

Fig loads completion specs for CLI tools and scripts in different orders.

  • A CLI tool is like git, docker, or kubectl that is an executable stored in your $PATH
  • A script is an executable, that you reference by its path as the first token e.g. ./ or node_modules/.bin/cowsay

Fig will assume you are referring to a CLI tool unless:

  1. The token contains a /
  2. The arg in the completion spec uses the isScript prop

CLI tools

Fig looks to load completion specs for CLI tools in the following order

  1. Private specs (exclusive associated with your personal account or team
  2. Public specs (in the src folder of withfig/autocomplete)
  3. The ~/.fig/autocomplete/build on your device

Finally, we check ~/fig/user/autocomplete/build/ for mixins

Example If you create a completion spec for your internal CLI tool called cargo and deploy this spec to your team account, then Fig would load up this spec when you type cargo[space] rather than the public cargo spec

Local Scripts

Fig looks to load completion specs for your local scripts in the following order:

  1. Specs in the .fig/autocomplete/build folder relative to the location of the script e.g. if you type ~/desktop/[space] Fig will search ~/desktop/.fig/autocomplete/build for a completion spec called

Fig will also check the .fig/user/autocomplete/build/ for mixins. e.g. in the above example, Fig will check ~/desktop/.fig/user/autocomplete/build for a mixin called

Note: Fig will also follow symlinks. e.g. if you do ./boostrap and the bootstrap executable is a symlink to ~/my/path/bootstrap, we will look in ~/my/path/.fig/autocomplete/build for a completion spec, not ./.fig/autocomplete/build