Skip to content

feat: case insensitive request methods#3

Merged
hars-21 merged 10 commits into
hars-21:mainfrom
akglaza:main
Jun 12, 2026
Merged

feat: case insensitive request methods#3
hars-21 merged 10 commits into
hars-21:mainfrom
akglaza:main

Conversation

@akglaza

@akglaza akglaza commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Currently, reqsh routes error messages directly to stdout. While this works for displaying text on a terminal, it creates significant issues for automation, scripting, and shell pipelines. When a command fails, downstream scripts expect clean data from stdout rather than having to parse error strings or stack traces.

The solution

This PR standardizes the application's output streams by ensuring that error diagnostics and execution failures are explicitly routed to stderr. This keeps stdout reserved strictly for successful data payloads, following standard CLI design principles.

Bonus

  • Printing help no longer requires a terminal with 1000 lines of height.
  • Passing a method to reqsh can be lower/UPPER/MiXEd case and still work.

@hars-21 hars-21 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for the PR!

Could you please revert the Cargo.toml changes that bump the version and add your name to the authors field?

We manage versioning and releases separately and the authors field is maintained by the project maintainers.

Everything else looks good and I'll continue the review once that's updated.

@akglaza

akglaza commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

@hars-21 -- revert completed. Thanks, AKG.

@hars-21 hars-21 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I feel the logger module is a bit overkill for now. It might fail in some edge cases. So, I recommend using eprintln! macro instead of logger to directly print error. This issue requires discussion as there are multiple ways it can be implemented.

@akglaza

akglaza commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

No problem. I will make the necessary corrections and update this PR. I was just trying to keep the existing functionality where in interactive mode, errors were printed to STDOUT. I am curious what edge cases you came across.

@akglaza

akglaza commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

@hars-21 -- Replaced logged module with eprintln!() macro.

@hars-21

hars-21 commented Jun 12, 2026

Copy link
Copy Markdown
Owner

I am curious what edge cases you came across.

When STDIN is TTY then errors go to STDOUT. You can test it by running reqsh 2> err.log. The errors are not logged in STDERR.

Also, I am planning to add a tokenization layer which can fully fix this issue and support redirections as well in REPL.

@hars-21 hars-21 merged commit e7b818e into hars-21:main Jun 12, 2026
1 check passed
@hars-21 hars-21 changed the title Output Error Messages to stderr feat: case insensitive request methods Jun 12, 2026
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.

2 participants