DocsIntegratingIntegrationsClick

Fig Autocomplete & click

This tutorial will walk you through setting up Fig's integration with the Python CLI framework, click.

Add click_complete_fig to your project

pip install click_complete_fig

Generate the spec

Add new subcommand to your CLI tool.

  • You must pass in the root level CLI.
  • The add_completion_spec_command function will add a new generate-fig-spec to the passed in cli
from click_complete_fig import fig

@click.group()
def cli():
    pass

fig.add_completion_spec_command(cli)

You can now automatically generate the completion spec skeleton by running the following command:

$CLI generate-fig-spec > $CLI.ts

Now if you run my-cli generate-fig-spec you'll see it output a Fig completion spec!

Next Steps: now that you have successfully configured the integration you can either push the spec to the autocomplete repo or push it to Fig's cloud.