Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Path filters #16

Closed
ModProg opened this issue Nov 2, 2022 · 4 comments
Closed

Path filters #16

ModProg opened this issue Nov 2, 2022 · 4 comments

Comments

@ModProg
Copy link
Contributor

ModProg commented Nov 2, 2022

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.

@ModProg ModProg mentioned this issue Nov 2, 2022
@dnaka91
Copy link
Owner

dnaka91 commented Nov 2, 2022

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
Copy link
Contributor Author

ModProg commented Nov 2, 2022

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
Copy link
Contributor Author

ModProg commented Nov 2, 2022

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
Copy link
Owner

dnaka91 commented Nov 2, 2022

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.

@dnaka91 dnaka91 closed this as completed Nov 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants