Add a validation and suggestions for incorrect subcommands #10
Labels
enhancement
New feature or request
good first issue
Good for newcomers
Medium
Requires some effort and time
The current behavior of the treq command allows the execution of a request when a subcommand is omitted, potentially leading to confusion. For example, both treq GET url.com and treq url.com execute the same command. However, if the user mistypes a subcommand (e.g., treq GE url.com), it interprets the mistyped text as the URL and additional parameters, submitting a GET request for http://GE and attempting to validate url.com as a Request item.
The proposal is to implement a command validator specifically for default command requests (no subcommand provided). This validator will check for potential mistyped subcommands. If the entered command closely resembles a valid subcommand, provide a helpful suggestion to the user before executing the command.
Expected Behavior:
Additional Considerations:
treq get
ortreq GEt
, the recommendation to type GET should appear, regardless of the casing.The text was updated successfully, but these errors were encountered: