Skip to content

Support providing list and dictionary variables from command line. #2957

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

Closed
aaltat opened this issue Sep 12, 2018 · 3 comments
Closed

Support providing list and dictionary variables from command line. #2957

aaltat opened this issue Sep 12, 2018 · 3 comments

Comments

@aaltat
Copy link
Contributor

aaltat commented Sep 12, 2018

It's possible to provide scalar variables from command line:

--variable EXAMPLE:bar

But currently it's not possible to define list and dictionary variables from command line. To overcome the limitation, data can be passed as scalar variable or via variable file and then parse the data as list or dictionary. But it would be useful to make it possible to pass list and dict variables from the command line. Perhaps it would be good use same LIST__ and DICT__ prefixes that variable files support and then using Python's ast.literal_eval() to convert the valua to a list/dict. Something like this:

--variable "LIST__EXAMPLE:['foo', 'bar']"
@pekkaklarck
Copy link
Member

This would be useful and shouldn't be overly complicated to implement. I doubt I have time for that personally in the near future, but if someone else is interested, there ought to be still time to get it into RF 3.1 even.

@pekkaklarck
Copy link
Member

pekkaklarck commented Jan 14, 2019

Would be also handy to be able to use other non-string values. Not sure are custom objects worth the effort, but at least numbers, Booleans, None would be nice. I see two possibilities how to implement that:

  • Add a prefix like EVAL__ to mean that the value should be passed through ast.literal_eval. For example, --variable X:EVAL__42. This could be implemented as part of this issue.

  • Add support for using variables in the values. This would allow using the built-in variables to specify numbers, Booleans and None like --variable 'X:${42}'. Would also allow other possibly useful usages such as --variable HOST:1.2.3.4 --variable 'URL:http://${HOST}/example'. This would require its own issue.

@pekkaklarck
Copy link
Member

Issue #2946 proposes adding support for non-string variable values from the CLI. That covers also lists/dicts so let's close this one as its duplicate.

@pekkaklarck pekkaklarck added duplicate and removed help wanted Extra help appreciated labels Aug 15, 2019
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