import re import textwrap from typing import AbstractSet, Iterable, Optional, Tuple from rich.console import RenderableType from rich.highlighter import RegexHighlighter from rich.padding import Padding from rich.table import Table from rich.text import Text from httpie.cli.constants import SEPARATOR_GROUP_ALL_ITEMS from httpie.cli.options import Argument, ParserSpec, Qualifiers SEPARATORS = '|'.join(map(re.escape, SEPARATOR_GROUP_ALL_ITEMS)) STYLE_METAVAR = 'yellow' STYLE_SWITCH = 'green' STYLE_PROGRAM_NAME = 'bold green' STYLE_USAGE_OPTIONAL = 'grey46' STYLE_USAGE_REGULAR = 'white' STYLE_USAGE_ERROR = 'red' STYLE_USAGE_MISSING = 'yellow' MAX_CHOICE_CHARS = 80 LEFT_PADDING_2 = (0, 0, 0, 2) LEFT_PADDING_4 = (0, 0, 0, 4) LEFT_PADDING_5 = (0, 0, 0, 4) LEFT_INDENT_2 = (1, 0, 0, 2) LEFT_INDENT_3 = (1, 0, 0, 3) LEFT_INDENT_BOTTOM_3 = (0, 0, 1, 3) class OptionsHighlighter(RegexHighlighter): highlights = [ r'(^|\W)(?P