fastcore icon indicating copy to clipboard operation
fastcore copied to clipboard

using `*args` with `@call_parse`

Open deven367 opened this issue 3 years ago • 1 comments

I am trying to the use the call_parse decorator with *args and I can't seem to figure how to make it work. Here is the function definition,

@call_parse
def timesheet(*args):
  pass

When I call the function in the nb, there's no problem,

timesheet(2, 'OH', 3, 'CSDP', 3, 'OR')

however, while calling the functions from the terminal becomes a problem

(base) devengqc@17-CN0065CL-1:~/git/projects/personal$ timesheet --args "2, 'OH', 3, 'CSDP', 3, 'OR'"
usage: timesheet [-h] args
timesheet: error: argument args: invalid _empty value: "2, 'OH', 3, 'CSDP', 3, 'OR'"

I've tried other combinations as well in the terminal and they don't seem to work. Is there a way around this? Or am I doing something wrong?

deven367 avatar Sep 10 '22 06:09 deven367

That's not a feature of call_parse at the moment. A PR would be welcome if you'd like to add support for list params.

jph00 avatar Sep 11 '22 06:09 jph00