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 from httpie.output.ui.palette import GenericColor SEPARATORS = '|'.join(map(re.escape, SEPARATOR_GROUP_ALL_ITEMS)) STYLE_METAVAR = GenericColor.YELLOW STYLE_SWITCH = GenericColor.GREEN STYLE_PROGRAM_NAME = GenericColor.GREEN # .boldify() STYLE_USAGE_OPTIONAL = GenericColor.GREY STYLE_USAGE_REGULAR = GenericColor.WHITE STYLE_USAGE_ERROR = GenericColor.RED STYLE_USAGE_MISSING = GenericColor.YELLOW STYLE_BOLD = 'bold' MAX_CHOICE_CHARS = 80 LEFT_PADDING_2 = (0, 0, 0, 2) LEFT_PADDING_3 = (0, 0, 0, 3) 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) MORE_INFO_COMMANDS = """ To learn more, you can try: -> running 'http --manual' -> visiting our full documentation at https://httpie.io/docs/cli """ class OptionsHighlighter(RegexHighlighter): highlights = [ r'(^|\W)(?P