Skip to main content

a ``formatter_class`` for ``argparse`` that deals with ANSI colour escapes. Specifically, this formatter does not count escape characters as displayed characters when wrapping ``argparse``'s help text into the terminal.

Project description


.. list-table::
:header-rows: 1

* - Branch
- Build Status
- Coverage Status
* - master
-
.. image:: https://semaphoreci.com/api/v1/emergence/argparse-color-formatter/branches/master/shields_badge.svg
:target: https://semaphoreci.com/emergence/argparse-color-formatter
:alt: Build Status

-
.. image:: https://docs.emergence.com/argparse-color-formatter/htmlcov_master/coverage.svg
:target: https://docs.emergence.com/argparse-color-formatter/htmlcov_master/
:alt: Coverage Status

* - develop
-
.. image:: https://semaphoreci.com/api/v1/emergence/argparse-color-formatter/branches/develop/shields_badge.svg
:target: https://semaphoreci.com/emergence/argparse-color-formatter
:alt: Build Status

-
.. image:: https://docs.emergence.com/argparse-color-formatter/htmlcov_develop/coverage.svg
:target: https://docs.emergence.com/argparse-color-formatter/htmlcov_develop/
:alt: Coverage Status

Install
-------

.. code-block:: shell

$ pip install argparse-color-formatter

Usage
-----

Pass in ``argparse_color_formatter.ColorHelpFormatter`` to a new argument parser as ``formatter_class``

.. code-block:: python

import argparse
from argparse_color_formatter import ColorHelpFormatter

parser = argparse.ArgumentParser(
formatter_class=ColorHelpFormatter
)

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-color-formatter-1.1.0.tar.gz (5.6 kB view hashes)

Uploaded Source

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