Skip to main content

Autogenerate completions for CLI tools built with argparse

Project description

Autogenerate Completions for CLI tools built with argparse

This package generates Fig completions for CLI tools built with Python's built-in argparse module.

Installation

Install the integration as a dependency using pip:

pip install argparse-complete-fig

Usage

import argparse
from argparse_complete_fig import add_completion_spec_command

parser = argparse.ArgumentParser(prog='my-cli')

# Call on your root-level parser for full completions
add_completion_spec_command(parser)

Calling the add_completion_spec_command function will add a --generate-fig-spec argument to the parser. When your CLI is invoked with this flag it will print a Fig spec.

To save your completion spec skeleton to a file, run the following:

my-cli --generate-fig-spec > my-cli.ts

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

argparse_complete_fig-1.0.1.tar.gz (5.2 kB view hashes)

Uploaded Source

Built Distribution

argparse_complete_fig-1.0.1-py3-none-any.whl (4.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page