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

Integration with clap #37

Closed
makspll opened this issue Dec 21, 2022 · 7 comments
Closed

Integration with clap #37

makspll opened this issue Dec 21, 2022 · 7 comments
Labels
enhancement New feature or request

Comments

@makspll
Copy link
Collaborator

makspll commented Dec 21, 2022

Clap is a CLI argument parser for rust. It is clear it contains functionality which could be very useful to this crate. It is entirely possible that a large amount of logic can be outsourced to clap which would be very beneficial.

Clap offers argument formats which are much more flexible than the current parser can handle at the moment.

We might still need a macro on top of the original clap macro to control which options are available to the user (since some features like env variables should likely not be made available)

@makspll makspll added the enhancement New feature or request label Dec 21, 2022
@alice-i-cecile
Copy link
Contributor

I would be happy to review and mentor this issue if anyone wants to tackle it.

@makspll
Copy link
Collaborator Author

makspll commented Jan 5, 2023

I've started some experimental work on the 'feature/clap-integration' branch. A dual derive macro setup where the second derive macro implements validity checks and additional necessary traits seems to work well, need to make sure there aren't ways to break this via certain clap features but looking good so far

@makspll
Copy link
Collaborator Author

makspll commented Jan 8, 2023

I am now looking at integrating the coloured output from clap as well, there is one issue: clap-rs/clap#4611. I don't think there is a way to get the styling information from the StyledStr's which is annoying. is std::mem::transmute into a replicating public type a good idea here :P

@alice-i-cecile
Copy link
Contributor

Drop it from the MVP and keep the initial PR smaller IMO :)

@makspll makspll mentioned this issue Jan 8, 2023
@makspll
Copy link
Collaborator Author

makspll commented Jan 8, 2023

MVP available over at #39 now, reviews would be appreciated as this changes the fundamental way this crate works

@makspll makspll closed this as completed Jan 9, 2023
@ConnorBP
Copy link

Is colored console supported yet? I believe that clap has stabilized its api here: clap-rs/clap#4765

@makspll
Copy link
Collaborator Author

makspll commented Jan 19, 2024

Not yet, but if this is the case then I think we can add that pretty easily, looks like we'll have to parse the ANSI chars and interpret them appropriately ourselves

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants