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

More explicit error message when initializaing in a repository with an invalid name #186

Open
qsantos opened this issue Dec 7, 2023 · 1 comment
Labels
complexity::low Issues or ideas with a low implementation cost component::cli Everything related to the buffrs cli type::fix

Comments

@qsantos
Copy link
Contributor

qsantos commented Dec 7, 2023

When trying to run buffrs init in a directory with an invalid name for a package, for instance a.b, the error message does not explain that the name was automatically inferred from the name of the directory. In particular, the name is not shown.

Compare the error message of buffrs init with that of cargo init:

~/a.b% buffrs init
Error:   × failed to initialize impl package
  ╰─▶ package name must consist of only ASCII lowercase and dashes, but contains . at position 1

~/a.b% cargo init
error: invalid character `.` in package name: `a.b`, characters must be Unicode XID characters (numbers, `-`, `_`, or most letters)
If you need a package name to not match the directory name, consider using --name flag.
If you need a binary with the name "a.b", use a valid package name, and set the binary name to be different from the package. This can be done by setting the binary filename to `src/bin/a.b.rs` or change the name in Cargo.toml with:
@qsantos qsantos added complexity::low Issues or ideas with a low implementation cost component::cli Everything related to the buffrs cli type::fix labels Dec 7, 2023
@qsantos qsantos added this to the User Experience milestone Dec 7, 2023
@khanism
Copy link

khanism commented Aug 5, 2024

Is this still relevant?
Trying this out I could not reproduce a error message in the case one skips the package name.
In the case I explicitly give a package name it produces the following error message:

error: invalid value 'hello.world' for '[PACKAGE]': package name must consist of only ASCII lowercase and dashes, but contains . at position 5

So the package name the error refers to is actually shown in this result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
complexity::low Issues or ideas with a low implementation cost component::cli Everything related to the buffrs cli type::fix
Projects
None yet
Development

No branches or pull requests

2 participants