Skip to content

fix: Allow options to appear before URL (#1592)#1708

Open
plausibleCoder wants to merge 1 commit intohttpie:masterfrom
plausibleCoder:fix-1592-arg-parsing
Open

fix: Allow options to appear before URL (#1592)#1708
plausibleCoder wants to merge 1 commit intohttpie:masterfrom
plausibleCoder:fix-1592-arg-parsing

Conversation

@plausibleCoder
Copy link

Hello,

This pull request fixes issue #1592.

I have added a pre-parsing step that reorders the command-line arguments. This ensures that positional arguments (METHOD and URL) are moved to the front of the list, ahead of any optional arguments.

This allows the default argument parser to correctly handle commands like https GET --verify=no pie.dev/get, which previously failed.

I have confirmed locally that the fix works and the previously failing command now succeeds.

Copy link

@themavik themavik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Splitting argv with startswith('-') still treats values that belong to flags (the token right after --auth, etc.) as positionals, so those tokens get moved ahead of flags and argparse can mis-parse. nit: The "# In parse_args method" line is three-space-indented next to four-space code—looks like a stray edit.

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.

3 participants