Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read input strings from stdin when none were given directly #29

Merged
merged 1 commit into from
May 31, 2023

Conversation

elasticdog
Copy link
Member

This was very tricky to get right as I still wanted to have the nice clap error message about missing a required argument if there were no strings supplied via stdin or the normal arguments.

See:

Checklist

  • Ran cargo xtask fixup for formatting and linting
  • Modified all relevant documentation
  • Updated CHANGELOG.md per "Keep a Changelog" format
  • Added tests covering any code changes

This was very tricky to get right as I still wanted to have the nice
clap error message about missing a required argument if there were no
strings supplied via stdin or the normal arguments.

See:
- clap-rs/clap#3437
- clap-rs/clap#4539
@elasticdog elasticdog enabled auto-merge May 31, 2023 20:21
@github-actions github-actions bot added the dependencies Pull requests that update a dependency file label May 31, 2023
@elasticdog
Copy link
Member Author

elasticdog commented May 31, 2023

And for posterity, I did have to reference the rendering code to figure out the appropriate context information for the error kind I was using:

/https://github.com/clap-rs/clap/blob/78bb48b6b8ef4d597b4b30b9add7927a2b0b0d8d/clap_builder/src/error/format.rs#L261-L277

@elasticdog elasticdog added this pull request to the merge queue May 31, 2023
Merged via the queue into main with commit fac2cdd May 31, 2023
@elasticdog elasticdog deleted the push-xlnoloxsxylw branch May 31, 2023 20:31
@elasticdog elasticdog added the enhancement New feature or request label May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant