INNER CODE UNIT · Python
_URL_COLOR
hartwork/git-delete-merged-branches · git_delete_merged_branches/_argparse_color.py:12
_URL_COLOR = colorama.Fore.MAGENTA + colorama.Style.BRIGHT
_RESET_COLOR = colorama.Style.RESET_ALL
_SUBSTITUTIONS = (
("^([^ ].+):$", f"{_SECTION_COLOR}\\1{_RESET_COLOR}:"),
(
"(?<!\\w)(--?[a-z-]+) ([A-Z_]+)",
f"{_ARGUMENT_COLOR}\\1{_RESET_COLOR} {_PARAMETER_COLOR}\\2{_RESET_COLOR}",
),
("(?<!\\w)((?!--?merged)--?[a-z-]+)", f"{_ARGUMENT_COLOR}\\1{_RESET_COLOR}"),
("^(usage): ([^ ]+)\\b", f"{_SECTION_COLOR}\\1{_RESET_COLOR}: {_PROG_COLOR}\\2{_RESET_COLOR}"),
("(https://[^ ]+[^ .])", f"{_URL_COLOR}\\1{_RESET_COLOR}"),
)
def add_color_to_formatter_class(formatter_class):
class_name = formatter_class.__name__.replace("Formatter", "ColorFormatter")