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

Request: Accept parameters #42

Open
RyKilleen opened this issue Mar 10, 2022 · 1 comment
Open

Request: Accept parameters #42

RyKilleen opened this issue Mar 10, 2022 · 1 comment

Comments

@RyKilleen
Copy link

RyKilleen commented Mar 10, 2022

First of all really appreciate the library, thank you!

My app takes user input for opening urls, files, or executables. It'd be great to accept arguments when executables are run.

In short, something like:

open::with(r"taskkill.exe /f /im "LogiPresentationUI.exe" /t")

open::with("obs64.exe --startvirtualcam")

would be able to parse and pass the arguments at https://github.com/Byron/open-rs/blob/main/src/lib.rs#L240.

Potentially using CommandLineToArgvW?

I'm essentially a Rust novice and I have zero insight into what the ramifications might be for other OSes, but thanks for the consideration! Happy to try to hack on a PR if there's interest

ref KilleenCode/brancato#22

@Byron
Copy link
Owner

Byron commented Mar 12, 2022

This sounds like a reasonable request. From what I see there are two different kinds of arguments, some are for the launcher, and others are for the launched application.

The ones for the launched application might already work if a space-separated string is passed to the app correctly. On windows, it can just be that, I think , but on unix it needs to be pre-split. The latter isn't trivial as one would have to understand quoting and escape rules.

So I'd suggest to add something like that_with_args(&["args", "for", "launcher"], &["arg", "for", "app"]) to not break anything existing while making it easy to create a space-separated string on windows.
But that's just a guess, you might come up with other solutions and that's OK as well :) - feel free to get this ball rolling in a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants