Skip to content

dash in flags #771

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 2 commits into from
Nov 23, 2023
Merged

dash in flags #771

merged 2 commits into from
Nov 23, 2023

Conversation

burrbull
Copy link
Member

No description provided.

@burrbull burrbull changed the title Flags dash in flags Nov 23, 2023
Copy link
Member

@Emilgardis Emilgardis left a comment

Choose a reason for hiding this comment

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

nice, I wonder if we could use alias also to make this change backwards compatible.

For example, we could

trait ArgExt {
    // FIXME: better name
    pub fn long_with_snake_alias(&mut self, arg: &'static str) -> Self;
}
impl ArgExt for clap::Arg {
    pub fn long_with_snake_alias(&mut self, arg: &'static str) -> Self {
        self.long(arg).alias(arg.to_snake_case())
    }
}

@burrbull
Copy link
Member Author

nice, I wonder if we could use alias also to make this change backwards compatible.

Yes, clap supports aliases
https://docs.rs/clap/latest/clap/struct.Arg.html#method.alias

@burrbull burrbull marked this pull request as ready for review November 23, 2023 20:23
@burrbull burrbull requested a review from a team as a code owner November 23, 2023 20:23
Emilgardis
Emilgardis previously approved these changes Nov 23, 2023
Copy link
Member

@Emilgardis Emilgardis left a comment

Choose a reason for hiding this comment

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

I don't like the repetition and would prefer the long_with_snake_alias approach but it's not a hard requirement.

I'd add that the reason we ended up using snake_case for multi word flags instead of kebab-case was just because we ended up doing it that way in #362

I think we've had discussions about this before but I can't find those discussions. Anyway, LGTM!

@Emilgardis Emilgardis requested a review from a team November 23, 2023 21:06
@burrbull burrbull added this pull request to the merge queue Nov 23, 2023
@Emilgardis Emilgardis removed this pull request from the merge queue due to a manual request Nov 23, 2023
@Emilgardis
Copy link
Member

sorry! changelog line 12 should be changed

@Emilgardis Emilgardis enabled auto-merge November 23, 2023 21:16
@Emilgardis Emilgardis added this pull request to the merge queue Nov 23, 2023
Merged via the queue into master with commit c6fbca1 Nov 23, 2023
@Emilgardis Emilgardis deleted the flags branch November 23, 2023 21:29
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