feat: show request items separators in naked invocation usage - #1952
Open
TrueFurina wants to merge 1 commit into
Open
feat: show request items separators in naked invocation usage#1952TrueFurina wants to merge 1 commit into
TrueFurina wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Running bare
http(or making an argument error likehttp --pretty) prints only the one-line usage and the error. The full option reference is behindhttp --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:
This follows the direction discussed in #428 (keeping
http --helpas the full reference while making the short output self-sufficient for the most common lookup).Closes #428
Changelog
httpie/output/ui/rich_help.py: addto_request_items_cheatsheet()rendering the common separators as plain texthttpie/cli/argparser.py: print the cheatsheet under the usage line inprint_usage()tests/test_cli_ui.py: extendNAKED_BASE_TEMPLATEto assert the new outputTesting
python -m pytest tests/test_cli_ui.py— 4 passed (updated naked-invocation assertions)http(bare),http --pretty, andhttp --pretty $invalidall render the cheatsheet correctly on stderrNote: the full test suite was not run locally because many integration tests hit live network endpoints; CI will cover the rest.