piccolo-orm / targ

Python CLI using type hints and docstrings.
https://targ.readthedocs.io/en/latest/index.html
MIT License
20 stars 2 forks source link

Error using name argument with positional argument #23

Open akankshasainics opened 2 years ago

akankshasainics commented 2 years ago

for this function

from targ import CLI

def add(a: int, b: int):
    """
    Add the two numbers.

    :param a:
        The first number.
    :param b:
        The second number.
    """
    print(a + b)

if __name__ == "__main__":
    cli = CLI()
    cli.register(add)
    cli.run()`

if I am running the command

python3 main.py add 3 --b=4

Output is 7.

But for this command

python3 main.py add --a=3 4

It is giving following error.

The command failed.
add() missing 1 required positional argument: 'b'
For a full stack trace, use --trace
dantownsend commented 2 years ago

@akankshasainics You're right - that's an interesting bug. We should write a unittest and try and work out why it's happening.