Hi,
Imagine you have cli software (like me) with the following option:
@click.option('categories', '-c', '--categories',
type=str,
multiple=True,
prompt="Categories",
default="foo",
help='Set categories for this document')
So if you dont provide this parameter, you get prompted for it.
Categories [(u'f', u'o', u'o')]:
Please help me understand in what way splitting up the parameters this way makes sense. Im really having a hard time thinking about it.
Wouldn't it make much more sense to split them by space?
In the meantime, i worked around using the following, within my function:
categories = ''.join(list(categories)).split()
I've also found Issue 218, but the answer is not really satisfying.
Please help me understand in what way splitting up the parameters this way makes sense.
Since multiple=True and type=str mean that you can provide _multiple string_ values, the default value is interpreted as an iterable of strings. If you iterate over a string, you get its individual characters.
However, I agree with you that splitting by characters isn't really desirable when _entering_ a value into the prompt.
I'd really like to see this behavior explicitly disallowed or properly implemented.
cc @mitsuhiko, ref #218
It seems like this should just be disallowed based on comments from @untitaker and @mitsuhiko.