I have a command line tool built with Python's click library. I want to extend this tool to use user-defined keywords like the following:
$ my-cli --foo 10 --bar 20
Normally I would add the following code to my command
@click.option('--foo', type=int, default=0, ...)
However in my case there are a few keywords that are user defined. I won't know that the user wants to sepcify foo or bar or something else ahead of time.
One solution
Currently, my best solution is to use strings and do my own parsing
$ my-cli --resources "foo=10 bar=20"
Which would work, but is slightly less pleasant.