Skip to content

Newer versions of Python Argparse give you Colors on Usage String #94

@chalbersma

Description

@chalbersma

Newer version of Python's argparse return colors. Colors are nice. but they partially break this tool:

�[1;34musage: �[0m�[1;35mtfreport.py�[0m [�[32m-h�[0m] [�[36m--level �[33mLEVEL�[0m] [�[32m-v�[0m] �[32mpath�[0m

It looks like the terminal stuff is leaking in there.

I can fix it by making color=False in my thing = argparse.ArgumentParser(... color=False) and it corrects in the documentation. Or when running my sphinx build/make I can set NO_COLOR=1:

NO_COLOR=1
make clean; make html

... yeilds a readable

usage: tfreport.py [-h] [--level LEVEL] [-v] path

And it will do the right thing. But I wonder if there's an option to disable color "on the fly" so that this tool can always be no color (or if colors could be supported, that would be cool too).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions