dnaka91 / cargo-hatch

Hatch new projects like a chick coming out of its egg
GNU Affero General Public License v3.0
7 stars 1 forks source link

Path filters #16

Closed ModProg closed 1 year ago

ModProg commented 1 year ago

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 in project_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.

dnaka91 commented 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.

ModProg commented 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.

well it works though, and I think we should be consistent with cargo new here: Screenshot_20221102-103249_Termux.jpg

ModProg commented 1 year ago

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.

dnaka91 commented 1 year ago

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.