Skip to content

feat: show request items separators in naked invocation usage - #1952

Open
TrueFurina wants to merge 1 commit into
httpie:masterfrom
TrueFurina:fix/compact-request-items-usage
Open

feat: show request items separators in naked invocation usage#1952
TrueFurina wants to merge 1 commit into
httpie:masterfrom
TrueFurina:fix/compact-request-items-usage

Conversation

@TrueFurina

Copy link
Copy Markdown

Description

Running bare http (or making an argument error like http --pretty) prints only the one-line usage and the error. The full option reference is behind http --help (400+ lines in a pager), yet the thing users most often forget — per #428 — is the request item separators (==, =, :=, @, :), which appear in the usage line only as an opaque [REQUEST_ITEM ...] placeholder.

This PR adds a compact request-items cheatsheet to the naked-invocation/usage error output, right under the usage line:

usage:
    http [METHOD] URL [REQUEST_ITEM ...]
request items (common separators, run 'http --help' for all options):
    ==    Query params
    =     Data fields (string)
    :=    Data fields (raw JSON)
    @     File upload
    :     HTTP headers

error:
    the following arguments are required: URL

for more information:
    run 'http --help' or visit https://httpie.io/docs/cli

This follows the direction discussed in #428 (keeping http --help as the full reference while making the short output self-sufficient for the most common lookup).

Closes #428

Changelog

  • httpie/output/ui/rich_help.py: add to_request_items_cheatsheet() rendering the common separators as plain text
  • httpie/cli/argparser.py: print the cheatsheet under the usage line in print_usage()
  • tests/test_cli_ui.py: extend NAKED_BASE_TEMPLATE to assert the new output

Testing

  • python -m pytest tests/test_cli_ui.py — 4 passed (updated naked-invocation assertions)
  • Manually verified http (bare), http --pretty, and http --pretty $invalid all render the cheatsheet correctly on stderr

Note: the full test suite was not run locally because many integration tests hit live network endpoints; CI will cover the rest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compact help

1 participant