0%

Comprehensive Introduction to Fig

Fig is a tool designed to improve efficiency and collaboration in command line usage. It offers a range of features. Recently, due to work requirements, I gained a relatively comprehensive understanding of Fig, so I’m marking it down here.

Supported Platforms

  1. Currently only supports Mac

  2. Linux is still in development, see the specific status at

Other Features Beyond Completion

  1. Dotfiles
  2. Scripts

Principle of Completion

  1. Traditional command completion is installed on the target machine, and many command-line tools either lack completion support or support it in a fragmented way. Fig chooses to solve this on the client side. For example, after installing Fig, it essentially loads predefined specifications on the client, prompting users to further select corresponding command options. After pressing enter, it writes back to the original terminal, thus solving the problem of difficult command input for users. Therefore, the advantage of this solution is speed, although it also consumes a certain amount of performance and space, as the more commands a user has, the more commands need to be loaded.
  2. Fig can display completion GUI across terminals
    1. The GUI itself is built with front-end JS/HTML/CSS
    2. Terminal interaction is achieved through a combination of Shell function hooks, Accessibility positioning, and front-end completion display, etc.

Resources of Fig

Fig is not just an App, it has contributed a set of resources over the years

  1. Completion Specifications

    The standards loaded in the App come from here, and with the power of the GitHub community, they are continuously updated. If you want to create a completion tool, then the specifications here can be directly used, as the Fig App is also a user of this set of specifications

    https://github.com/withfig/autocomplete

  2. Completion Specification Scaffold

    https://github.com/withfig/autocomplete-tools

    For example, if you want to contribute to the specifications or debug them, you can use the official completion tools.

  3. Command Manual

    If you want to know which commands Fig includes, you can check here

    https://fig.io/manual

Fig Next

On 08/28/2023, Fig was acquired by Amazon, which demonstrates the value of Fig.

Currently, downloading Fig from the official website, the DMG has been changed to CodeWhisperer [the product name launched after Amazon’s acquisition]. If you are still accustomed to the previous UI, it is recommended to install via brew, which still retains Fig.

https://fig.io/blog/post/fig-joins-aws

Products Implemented Using Fig Completion Specifications

  1. warp
  2. inshellisense

In Conclusion

Fig is an App, among which the most important feature is command completion. The most valuable aspect of Fig is not the App itself, but the establishment of a complete set of completion specification protocols. With the power of the community, it has also contributed 500+ command completion specifications. If we talk about subcommands, there are currently 28k. Therefore, it’s fantastic.

  1. https://fig.io/blog
  2. https://github.com/withfig