Skip to content

feat(error): Expose error building blocks#3402

Merged
epage merged 35 commits into
clap-rs:masterfrom
epage:context
Feb 7, 2022
Merged

feat(error): Expose error building blocks#3402
epage merged 35 commits into
clap-rs:masterfrom
epage:context

Conversation

@epage

@epage epage commented Feb 4, 2022

Copy link
Copy Markdown
Member

This has some limited programmatic use but the focus is on allowing people to format the errors as they wish.

Downside is that the .text section for the git example went from 547.9KiB to 566.8KiB. Error::formatted is the sixth largest clap function at 6.0KiB.

Fixes #2628
Fixes #3227

@ducaale

ducaale commented Feb 5, 2022

Copy link
Copy Markdown
Contributor

Can you add a brief example of how users could format errors after this change? Thanks

@epage

epage commented Feb 5, 2022

Copy link
Copy Markdown
Member Author

Can you add a brief example of how users could format errors after this change? Thanks

It might not stay this way but as of right now, this PR has clap format using context so it serves as its own example (and makes sure the data is complete enough)

fn formatted(&self) -> Cow<'_, Colorizer> {

@epage epage marked this pull request as ready for review February 7, 2022 19:04
@epage epage merged commit 6bfe7f5 into clap-rs:master Feb 7, 2022
@epage epage deleted the context branch February 7, 2022 21:37
@epage epage mentioned this pull request Feb 8, 2022
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.

Is it possible to not show usage string in post validation errors? Supplement clap::Error.info with helper methods

2 participants