Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] what is the reason that "AsRef<str>" is used as input instead of "AsRef<Path>"? #15

Closed
hasezoey opened this issue Jan 19, 2022 · 3 comments · May be fixed by #18
Closed

[Question] what is the reason that "AsRef<str>" is used as input instead of "AsRef<Path>"? #15

hasezoey opened this issue Jan 19, 2022 · 3 comments · May be fixed by #18

Comments

@hasezoey
Copy link

like the title says, why is it that all function require the input to be AsRef<str> and not AsRef<Path>? this means that when you have a input Path / PathBuf, you would have to first convert it to a UTF8 valid string, which could invalidate the input path

@Nukesor
Copy link

Nukesor commented Mar 11, 2022

Ping @netvl

If this is some functionality you could imagine being added to the library, I would go ahead and create a PR for this :)

It would obviously need to be a separate function. Something like tilde_path? path_tilde, expand_path_tilde. Not sure about the naming yet.

hasezoey added a commit to hasezoey/shellexpand that referenced this issue Mar 26, 2022
…tead

add a module named "with_path"
add function "with_path::tilde_with_context" that uses Paths instead
"with_path::tilde" that uses Paths instead

fixes netvl#15
@ijackson
Copy link

ijackson commented Aug 3, 2022

Hi. As discussed in #17 I am taking over maintenance of this crate. The new repository is here: https://gitlab.com/ijackson/rust-shellexpand

I agree that supporting Path too would be good, but it's not trivial. I have filed https://gitlab.com/ijackson/rust-shellexpand/-/issues/2 about this, with some discussion.

@hasezoey
Copy link
Author

hasezoey commented Aug 3, 2022

@hasezoey hasezoey closed this as completed Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants