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

Idiomatic way to include optional arguments in command #51

Closed
rob-p opened this issue Jul 17, 2022 · 1 comment
Closed

Idiomatic way to include optional arguments in command #51

rob-p opened this issue Jul 17, 2022 · 1 comment

Comments

@rob-p
Copy link

rob-p commented Jul 17, 2022

I'd like to run a command / function where what is run is composed of some dynamic options passed in by the user. So I have a command and depending on whether or not the user passes some argument to my rust program, I'd like to run (via run_fun!) another external program either including or not this option. There are several such options, so enumerating all possibilities grows combinatorially.

I tried building a single command string, but realized the run_fun! macro won't tokenize that on spaces the way the subprocess needs. What is the recommended way to achieve this functionality in cmd_lib?

Thanks!
Rob

@rust-shell-script
Copy link
Owner

You can use $[] to access vector variable, see README or closed issues for some examples.

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

No branches or pull requests

2 participants