Skip to main content

Wrapper around Click python library

Project description

A wrapper around the Click library for Python. PyCmds makes it easier to use Click’s command execution framework independently of the command line (i.e. executing Click Commands in an existing Python instance.)

To accompany this, PyCmds adds a CmdCompleter class which implements the Completer interface from the python-prompt-toolkit. Using this class, one may create a python-prompt-toolkit interface with intelligent (see below) autocompletion for Click Commands and Options.

Also, PyCmds adds an AliasGroup class to allow the assignment of aliases to Click Commands.

CmdCompleter Features

  • Only displays completion menu when the completer is certain of what options or subcommands are valid. (E.g. no naive option or subcommand suggestions when Click is expecting a value for a previous option.)

  • Considers click.Option.is_flag and click.Parameter.nargs to decide how many values a option should consume.

  • Considers click.Option.count and click.Option.multiple to decide if more than one instance of the same option should be permitted.

  • Smart autocompletion for grouped short flags with or without a value clustered on the end.

Important Notes About CmdCompleter

  • Designed primarily for POSIX-style options.

  • Only context settings specified on the root/top-level Command will be considered (by necessity).

  • Incompatible with click.Context.allow_interspersed_args.

  • Incompatible with click.Context.ignore_unknown_opts.

  • Incompatible with click.MultiCommand.chain.

  • The split character for parameters with nargs > 1 is expected to be a space.

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

pycmds-1.0.4.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

pycmds-1.0.4-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file pycmds-1.0.4.tar.gz.

File metadata

  • Download URL: pycmds-1.0.4.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for pycmds-1.0.4.tar.gz
Algorithm Hash digest
SHA256 356f2fc5713e5ac3e211e13b7735034aec07c9307f41715a2213d062ecac3abb
MD5 6f335e377b565d7a28528383d8621b38
BLAKE2b-256 0876867fa23d4d6668e599f365e9a197f1d53af6ce2d97d1ef51299888933e20

See more details on using hashes here.

File details

Details for the file pycmds-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: pycmds-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for pycmds-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c7d7b633fec2ce906115959966dae4a9f0e91ad9b13fdac5fbc040c18174be75
MD5 027efca565265434ed06310fca615af2
BLAKE2b-256 1e432028a4800b8b8257449c9a28d0928443aa872aa37823019ef6e5b4bf9217

See more details on using hashes here.

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