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

Feat/completion #54

Conversation

GabrielBrandao1618
Copy link
Contributor

So, the completion command works the following way:

quartz completion --shell <shell>

The only thing I am kind of struggling to implement is this detailed description that github CLI provides. I couldn't find a way to implement this flags section specifying the available shells.
image

src/action/completion.rs Outdated Show resolved Hide resolved
}
}

pub fn completion(args: CompletionArgs) {

Choose a reason for hiding this comment

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

Probably my bad for not writing about coding styles, but the pattern uses cmd for the main action function. That way, so we can call action::completion::cmd.

Suggested change
pub fn completion(args: CompletionArgs) {
pub fn cmd(args: CompletionArgs) {

@EduardoRodriguesF
Copy link
Owner

EduardoRodriguesF commented Jul 28, 2024

I couldn't find a way to implement this flags section specifying the available shells.

We can be more practical and change how it displays the value, altering the value_name attribute to bash|zsh|....

src/cli.rs Outdated Show resolved Hide resolved
@EduardoRodriguesF
Copy link
Owner

Hey, I just found out that there is a way to define enums as arguments.

https://www.rustadventure.dev/introducing-clap/clap-v4/introducing-enums-as-clap-arguments

Could you implement that for the shell flag?

@EduardoRodriguesF EduardoRodriguesF mentioned this pull request Jul 28, 2024
@EduardoRodriguesF EduardoRodriguesF changed the base branch from master to completion July 28, 2024 12:37
src/action/completion.rs Outdated Show resolved Hide resolved
@GabrielBrandao1618
Copy link
Contributor Author

Hey, I just found out that there is a way to define enums as arguments.

https://www.rustadventure.dev/introducing-clap/clap-v4/introducing-enums-as-clap-arguments

Could you implement that for the shell flag?

Oh, that's great! I am definitively checking this out ASAP

Man, I wish Clap docs had more examples since it relies a lot in macros😓

@EduardoRodriguesF
Copy link
Owner

Man, I wish Clap docs had more examples since it relies a lot in macros😓

Yeah, their docs on macros are pretty scarce. I was considering refactoring it to the builder format, but it would take some time to do so.

@EduardoRodriguesF
Copy link
Owner

Merging on a separate branch so we can work fully on #36 before actually releasing.

@EduardoRodriguesF EduardoRodriguesF merged commit 9b3a77b into EduardoRodriguesF:completion Jul 28, 2024
3 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