Jaymon / captain

command line python scripts for humans
MIT License
13 stars 1 forks source link

Inferring non-named args when they aren't explicitly defined using @arg #64

Closed Jaymon closed 1 year ago

Jaymon commented 3 years ago

This failed:

class Foo(Command):
    def handle(self, bar):
        self.output.out(bar)

when running this command:

$ python filename.py foo "bar value"

I bet it would've worked if I did this:

$ python filename.py foo --bar "bar value"

It Did work as expected when I added the @arg:

class Foo(Command):
    @arg("bar")
    def handle(self, bar):
        self.output.out(bar)

I'm wondering if there is a way to make the inference engine work for non-named arguments