Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error using name argument with positional argument #23

Open
akankshasainics opened this issue Oct 12, 2022 · 1 comment
Open

Error using name argument with positional argument #23

akankshasainics opened this issue Oct 12, 2022 · 1 comment

Comments

@akankshasainics
Copy link

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
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants