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

Passing arguments from ti CLI to examples #3216

Open
Hanke98 opened this issue Oct 18, 2021 · 0 comments
Open

Passing arguments from ti CLI to examples #3216

Hanke98 opened this issue Oct 18, 2021 · 0 comments
Labels
feature request Suggest an idea on this project

Comments

@Hanke98
Copy link
Contributor

Hanke98 commented Oct 18, 2021

Concisely describe the proposed feature

Passing the arguments from ti example ... to the example scripts. e.g.:

ti example stable_fluid -S

I would like this command to pass the arg -S to the stable_fluid.py file and be parsed later.

Describe the solution you'd like (if any)

Actually, the current implementation will pass the args to the examples, however, unrecognized arguments will stop the ti example CLI program. This is because we are using ArgumentParser.parse_args():

args = parser.parse_args(arguments)

A possible solution is: use ArgumentParser.parse_known_args() and only pass the sys.args[2:] to the downstream.

Additional comments

Note that, if we use ArgumentParser.parse_known_args(), we have to carefully check the args for ti example, since we need to give a user-friendly CLI error prompt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Suggest an idea on this project
Projects
None yet
Development

No branches or pull requests

1 participant