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

Support kebab-case names in parse sepc #177

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Gnnng
Copy link

@Gnnng Gnnng commented Aug 14, 2020

This pull request improves the user experience when package names contain hyphens. Users can use either the original form (my-app) or the canonical form (my_app).

See more about name using hyphens in this RFC.

Fixes #197

@jplatte
Copy link
Contributor

jplatte commented Aug 20, 2020

Hey, thanks for the PR, and sorry for the delay in reacting to it. I just don't feel like I should be deciding whether to include this kind of functionality, only being involved in this project for a rather short time.

That said, personally I like this change. The only improvement I can suggest is mentioning this in README.md too.

@sirwindfield @KodrAus wdyt?

@mainrs
Copy link
Contributor

mainrs commented Aug 20, 2020

I do like the change! Is it possible that two crates exist with the same name but one uses hyphens, the other dashes? I can only imagine that this can't be the case, as their import names would be the same. This would be the only concern I'd have though.

src/filter/mod.rs Outdated Show resolved Hide resolved
@jplatte
Copy link
Contributor

jplatte commented Aug 20, 2020

The crate name isn't necessarily determined by the package name, you can overwrite it in the [lib] section¹. I don't actually know how this interacts with log though.

¹ https://doc.rust-lang.org/cargo/reference/cargo-targets.html#configuring-a-target

@jplatte
Copy link
Contributor

jplatte commented Aug 20, 2020

@Gnnng I thought it was obvious so didn't leave another review comment, but the typo was replicated in the assertion a few lines below, you need to update that one too :)

@Gnnng
Copy link
Author

Gnnng commented Aug 20, 2020

My bad, just fixed it and rebased it. Thanks for reviewing it. Any suggestions on what to put in the README.md? It's better if it comes from the maintainers so feel free to amend the PR.

@jplatte
Copy link
Contributor

jplatte commented Aug 20, 2020

Any suggestions on what to put in the README.md?

I was thinking something similar to what you wrote for lib.rs.

@KodrAus
Copy link
Collaborator

KodrAus commented Jan 11, 2021

This looks good to me! There shouldn't be any conflicts for names. Cargo accepts either - or _ but considers those characters equal for determining the name.

@jplatte
Copy link
Contributor

jplatte commented Jan 14, 2021

@Gnnng Can you rebase again and add this to the readme? If not I might do it, but no promises.

@Gnnng
Copy link
Author

Gnnng commented Jan 14, 2021

Sure, let me do that.

Gnnng and others added 3 commits January 14, 2021 21:34
@mainrs
Copy link
Contributor

mainrs commented Mar 7, 2021

I can take a closer look an Tuesday, up until then I don't have enough time for a full review :)

Copy link
Contributor

@mainrs mainrs left a comment

Choose a reason for hiding this comment

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

Looks good. Tests are there and proper documentation has been added to both the readme and the doc comments.

Copy link
Contributor

@jplatte jplatte left a comment

Choose a reason for hiding this comment

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

So with the crate name also being overridable replacing - by _ is not always the right conversion from package name to crate name (example: rust-s3 where the package is named rust-s3 but the library crate is named s3, not rust_s3).

I guess this still doesn't break anything though, it could just be expected by people that it does more than it actually does 🤷🏼

@mainrs
Copy link
Contributor

mainrs commented Mar 22, 2021

So with the crate name also being overridable replacing - by _ is not always the right conversion from package name to crate name (example: rust-s3 where the package is named rust-s3 but the library crate is named s3, not rust_s3).

I guess this still doesn't break anything though, it could just be expected by people that it does more than it actually does 🤷🏼

We could add a notice to the README with this example to bring attention to these cases 🤔

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.

Handle hyphens internally
4 participants