Open coopbri opened 2 years ago
Thanks for the report, this must have been very annoying.
I would suggest that in these instances we could print something like this
"We were not able to create your project as gleam
as etc etc....
Would you like is to create a project named my_gleam
in a directory named gleam
? (Y/n)"
decouple Gleam project names from their parent folder name, allowing project directory names such as gleam-demo, gleam, and gleam_demo
This is already the case! Unfortunately we take the project name as the argument here and use the director name as the same.
Maybe instead of saying what it should not be it should say what it should be:
Maybe fully formulating what the project name must be helps?
Like:
Project name must be lowercase, alphanumeric, may not start with a number and may not be named gleam or begin with gleam_.
Thanks for the report, this must have been very annoying.
I would suggest that in these instances we could print something like this
"We were not able to create your project as
gleam
as etc etc....Would you like is to create a project named
my_gleam
in a directory namedgleam
? (Y/n)"decouple Gleam project names from their parent folder name, allowing project directory names such as gleam-demo, gleam, and gleam_demo
This is already the case! Unfortunately we take the project name as the argument here and use the director name as the same.
Not annoying at all! No worries.
I think coupling the solution from @inoas with the automated (Y/n)
prompt suggested by @lpil might be a nice approach. Basically conveying all of the restrictions in one go while also automating a suggested project name.
Fab, I agree. Let's do it
The solution: make it suggest an alternative name. The full list of problems could be suggested in the text also, though the main problem would need to be presented first and foremost as today.
@lpil Would be okay if I tackle this issue? I have been a developer for a over a year now, but for some reason, I have been intimidated in tackling a truly open source project. I am super excited about gleam and would like the language to be my first open source project to start contributing to. This would be a good first issue to stretch my legs.
Yes please! That'd be great. Do ask any questions if you have any while working on it.
Hey @lpil , I've been working on #3395 and this issue here seemed close enough to tackle next. I've already started hacking around for a solution, would it be alright to take this up? I also have some initial questions but I guess it would be best to ask those in a PR when the code suggestion can be checked out in context as well...
Great! Yes please @Tar-Tarus !!
Description
When creating a new Gleam project with
gleam new
, there are situations where thegleam
CLI will respond with errors due to disallowed project naming patterns:Context: based on this Twitter thread
Ideas
gleam
prefix) as well as underscore conventionAllow more project naming patterns; decouple Gleam project names from their parent folder name, allowing project directory names such as
gleam-demo
,gleam
, andgleam_demo
I like this idea the most of the three proposed here; this is allowed in, for example, a new Rust/Cargo project. You can create projects with analogous name
rust-demo
,rust
, andrust_demo
:Let me know if you have other ideas. I'm happy to take this on after a consensus is reached!