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

feat: these for several path #78

Closed
wants to merge 3 commits into from

Conversation

Mehrbod2002
Copy link

@Mehrbod2002 Mehrbod2002 commented May 11, 2023

Fixes : #70
Allow several paths with these

Copy link
Owner

@Byron Byron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea of these would be to pass multiple paths to commands() at once. What makes this hard isn't the API though, it's validating that it even makes sense for the launchers that are offered on each platform. Not all of them may support multiple paths at all, which is when one would have to let it fall back to launching each command individually.

Besides that, any use of unsafe is unacceptable here and also not required. Instead of PathIter, try to use something like impl IntoIterator<Item = impl AsRef<OsStr>> or the version with explicit type constraints using where I: IntoIterator<Item = R>, R: AsRef<OsStr>, you will probably have to fiddle with lifetimes a bit.

@Mehrbod2002
Copy link
Author

@Byron
To be sure , multi path means open a browser with different path on different tabs ?

@Byron
Copy link
Owner

Byron commented May 12, 2023

I think it means that launchers who can take multiple paths at once can be provided with multiple paths. The effect of this is defined by its implementation.

@Mehrbod2002 Mehrbod2002 requested a review from Byron May 13, 2023 04:05
@Mehrbod2002
Copy link
Author

@Byron
I think there is a misunderstanding about this impl . the command with several means open an browser with multi path in multi tabs ?

Copy link
Owner

@Byron Byron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for trying to contribute!

However, it seems there is difficulty in communication and/or understanding, which is why I would prefer abandoning this PR instead of trying to push it into shape. My time is too scarce to be able to engage here.

Thanks for your understanding.

@@ -152,6 +153,22 @@ pub fn that(path: impl AsRef<OsStr>) -> io::Result<()> {
Err(last_err.expect("no launcher worked, at least one error"))
}

pub fn these(
path: impl IntoIterator<Item = impl AsRef<OsStr>> + std::convert::AsRef<std::ffi::OsStr>,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need for any function that can be emulated with for path in paths { open::that(path)?; } Instead, in order to implement it as described in #70, launchers must be fed multiple paths if they support it.

@Byron Byron closed this May 13, 2023
@Mehrbod2002 Mehrbod2002 deleted the several_paths branch May 13, 2023 08:33
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 this pull request may close these issues.

Allow several paths
2 participants