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
# argparse-color-formatter
A [`formatter_class` for `argparse`](https://docs.python.org/3/library/argparse.html#formatter-class) 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.
> ![That script's help text is so cool...](/acf.png "That script's help text is so cool...")
| Branch | Build Status | Coverage Status |
| ------ | ------------ | --------------- |
| master | [![Build Status](https://semaphoreci.com/api/v1/arrai-innovations/argparse-color-formatter/branches/master/shields_badge.svg)](https://semaphoreci.com/arrai-innovations/argparse-color-formatter) | [![Coverage Status](https://docs.arrai-dev.com/argparse-color-formatter/htmlcov_master/coverage.svg)](https://docs.arrai-dev.com/argparse-color-formatter/htmlcov_master/) |
| develop | [![Build Status](https://semaphoreci.com/api/v1/arrai-innovations/argparse-color-formatter/branches/develop/shields_badge.svg)](https://semaphoreci.com/arrai-innovations/argparse-color-formatter) | [![Coverage Status](https://docs.arrai-dev.com/argparse-color-formatter/htmlcov_develop/coverage.svg)](https://docs.arrai-dev.com/argparse-color-formatter/htmlcov_develop/) |
## Install
```shell
$ pip install argparse-color-formatter
```
## Usage
Pass in `argparse_color_formatter.ColorHelpFormatter` to a new argument parser as `formatter_class`
```python
import argparse
from argparse_color_formatter import ColorHelpFormatter
parser = argparse.ArgumentParser(
formatter_class=ColorHelpFormatter
)
```
## Before & After
ANSI colour escapes using the default `HelpFormatter`:
![before screenshot](/before.png)
ANSI colour escapes using this libraries new `ColorHelpFormatter`:
![after screenshot](/after.png)
A [`formatter_class` for `argparse`](https://docs.python.org/3/library/argparse.html#formatter-class) 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.
> ![That script's help text is so cool...](/acf.png "That script's help text is so cool...")
| Branch | Build Status | Coverage Status |
| ------ | ------------ | --------------- |
| master | [![Build Status](https://semaphoreci.com/api/v1/arrai-innovations/argparse-color-formatter/branches/master/shields_badge.svg)](https://semaphoreci.com/arrai-innovations/argparse-color-formatter) | [![Coverage Status](https://docs.arrai-dev.com/argparse-color-formatter/htmlcov_master/coverage.svg)](https://docs.arrai-dev.com/argparse-color-formatter/htmlcov_master/) |
| develop | [![Build Status](https://semaphoreci.com/api/v1/arrai-innovations/argparse-color-formatter/branches/develop/shields_badge.svg)](https://semaphoreci.com/arrai-innovations/argparse-color-formatter) | [![Coverage Status](https://docs.arrai-dev.com/argparse-color-formatter/htmlcov_develop/coverage.svg)](https://docs.arrai-dev.com/argparse-color-formatter/htmlcov_develop/) |
## Install
```shell
$ pip install argparse-color-formatter
```
## Usage
Pass in `argparse_color_formatter.ColorHelpFormatter` to a new argument parser as `formatter_class`
```python
import argparse
from argparse_color_formatter import ColorHelpFormatter
parser = argparse.ArgumentParser(
formatter_class=ColorHelpFormatter
)
```
## Before & After
ANSI colour escapes using the default `HelpFormatter`:
![before screenshot](/before.png)
ANSI colour escapes using this libraries new `ColorHelpFormatter`:
![after screenshot](/after.png)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for argparse-color-formatter-1.2.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b4870cea2ef3ac40d2b171aa43ef29b31e4c66d15b1b1b4da98c0d73c97f8d4 |
|
MD5 | 9717c8ae7ce2416caefc14d79830944b |
|
BLAKE2b-256 | 795d120e2486d84680dce5f779922e7fc8b27106917c2bf28b353496a81d1ce7 |