Closed ModProg closed 1 year ago
I'm not quite sure I understand. The project_name
variable is a CLI argument when generating a new project from a template. It is optional though, and when missing the name is derived from the current directory name.
Thus, you shouldn't have any need for an extra filter to only get the file name from a "path" as there is no actual path.
However, if you try to pass a path as project name, that might be possible, but is not the intended way of using it.
I'm not quite sure I understand. The
project_name
variable is a CLI argument when generating a new project from a template. It is optional though, and when missing the name is derived from the current directory name.Thus, you shouldn't have any need for an extra filter to only get the file name from a "path" as there is no actual path.
However, if you try to pass a path as project name, that might be possible, but is not the intended way of using it.
well it works though, and I think we should be consistent with cargo new here:
we should either disable file paths as project name, or my preferred solution would be to not change the current behavior but make the project-name
just the file_name.
I totally agree that this should be possible. This was an oversight from me, as I'm usually already in the right folder where I want to create my project, and didn't think about the idea of passing a file path.
Just pushed a new commit that adds support for this, which now treats the name
argument from the CLI as file path, and appends it to the current directory, to create the same effect as with plain cargo
.
Not sure if this is something that should be done in tera, but we could also just add these our selves.
Specifically, I'd like a
file_name
filter to get the name of the path inproject_name
Also, the name
project_name
is a bit confusing as it actually just is the relative/absolute path, that often ends up just being a dir name.