Given
# adder1.py
from clipstick import parse
from pydantic import BaseModel
class Adder(BaseModel):
ints: int
def run(self):
print(sum([self.ints]))
cmd = parse(Adder)
cmd.run()
this runs OK:
but this
# adder2.py
from clipstick import parse
from pydantic import BaseModel
class Adder(BaseModel):
ints: list[int]
def run(self):
print(sum(self.ints))
cmd = parse(Adder)
cmd.run()
fails for multiple arguments:
$ adder2.py 10 20
ERROR:
Missing a value for positional argument '--ints'
and requires
$ adder2.py --ints 10 --ints 20
30
It would be desirable that positional arguments for a collection could be passed just as values.
Given
this runs OK:
but this
fails for multiple arguments:
and requires
It would be desirable that positional arguments for a collection could be passed just as values.