Skip to content

feat(clap-complete): Introduce fallible generator #6009

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

Merged
merged 1 commit into from
May 27, 2025

Conversation

gtema
Copy link
Contributor

@gtema gtema commented May 22, 2025

It may happen that writing completion fails due to whichever reason. Currently clap-complete panics without letting calling code to react on that error (i.e. ignore). Introduce fallible version of the generate function by mostly only getting rid of except and instead exposing Result. For backwards compatibility make default trait implementation of try_generate function to call generate not to break users defining their own generate.

Issue: #5993

@gtema gtema force-pushed the complete_try_generate branch from 4082068 to c713eab Compare May 22, 2025 15:31
@gtema gtema force-pushed the complete_try_generate branch 2 times, most recently from 25efcf8 to 7cc0aae Compare May 26, 2025 07:52
It may happen that writing completion fails due to whichever reason.
Currently clap-complete panics without letting calling code to react on
that error (i.e. ignore). Introduce fallible version of the `generate`
function by mostly only getting rid of except and instead exposing
Result. For backwards compatibility make default trait
implementation of `try_generate` function to call `generate` not to
break users defining their own `generate`.

Issue: clap-rs#5993
@gtema gtema force-pushed the complete_try_generate branch from 7cc0aae to 21fc9e4 Compare May 27, 2025 07:20
@epage epage merged commit 3398b6a into clap-rs:master May 27, 2025
25 checks passed
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