kaxil commented on a change in pull request #7639: [AIRFLOW-7000] Allow passing
in env var JSON dict in task_test
URL: https://github.com/apache/airflow/pull/7639#discussion_r389980377
##########
File path: airflow/bin/cli.py
##########
@@ -459,6 +459,9 @@ class CLIFactory:
action="store_true",
help="Open debugger on uncaught exception",
),
+ 'env_vars': Arg(
+ ("--env-vars", ),
+ help="Set env var in both parsing time and runtime for each of
entry supplied in a JSON dict"),
Review comment:
Maybe we could add `type=json.loads` ? WDYT?
Example:
```python
>> import json
>> import argparse
>> test = '{"name": "img.png","voids": "#00ff00ff","0": "#ff00ff00","100%":
"#f80654ff"}'
>> parser = argparse.ArgumentParser()
>> parser.add_argument('-i', '--input', type=json.loads)
>> args = parser.parse_args(['-i', test])
>> print(args.input)
{u'0': u'#ff00ff00', u'100%': u'#f80654ff', u'voids': u'#00ff00ff', u'name':
u'img.png'}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services