talis-fb / TReq

A CLI tool for effortless HTTP requests
GNU General Public License v3.0
55 stars 2 forks source link

Add a validation and suggestions for incorrect subcommands #10

Open talis-fb opened 9 months ago

talis-fb commented 9 months ago

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: