buffrs icon indicating copy to clipboard operation
buffrs copied to clipboard

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

Open qsantos opened this issue 2 years ago • 1 comments

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 avatar Dec 07 '23 08:12 qsantos

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.

khanism avatar Aug 05 '24 19:08 khanism