From cc80cea19bd154a1dd131be835062b471411742f Mon Sep 17 00:00:00 2001 From: Steve Date: Fri, 23 Oct 2026 12:08:34 +0530 Subject: [PATCH] List pie styles by name in the --style invalid choice error --- httpie/output/formatters/colors.py | 2 +- tests/test_cli_ui.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/httpie/output/formatters/colors.py b/httpie/output/formatters/colors.py index 0d9bd12e2f..3a29a7cb96 100644 --- a/httpie/output/formatters/colors.py +++ b/httpie/output/formatters/colors.py @@ -385,4 +385,4 @@ def make_styles(): PIE_STYLES = make_styles() PIE_STYLE_NAMES = list(PIE_STYLES.keys()) -BUNDLED_STYLES |= PIE_STYLES.keys() +BUNDLED_STYLES |= {style.value for style in PIE_STYLES} diff --git a/tests/test_cli_ui.py b/tests/test_cli_ui.py index bb744cdc4e..9b7ae3e150 100644 --- a/tests/test_cli_ui.py +++ b/tests/test_cli_ui.py @@ -63,3 +63,14 @@ def fake_terminal_size(*args, **kwargs): def test_naked_invocation(ignore_terminal_size, args, expected_msg): result = http(*args, tolerate_error_exit_status=True) assert result.stderr == expected_msg + + +def test_invalid_style_lists_bundled_pie_styles_by_name(): + result = http( + '--style', '$invalid', '--offline', 'pie.dev', + tolerate_error_exit_status=True, + ) + assert 'invalid choice' in result.stderr + assert 'PieStyle' not in result.stderr + for name in ('pie', 'pie-dark', 'pie-light'): + assert name in result.stderr