Jaymon / captain

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

Inherited decorators should be able to be overridden or removed #73

Closed Jaymon closed 1 year ago

Jaymon commented 1 year ago

Bar should be able to inherit Foo's arguments and override them. Che shouldn't have foo as an argument. I'm not so passionate about being able to remove/omit the commands, but they should definitely be able to be overridden


class Foo(Command):
  @arg("foo", nargs="*")
  def handle(self, foo):
    self.output.out("foo CAN be empty")

class Bar(Command):
  @args(Foo)
  @arg("foo", nargs="+")
  def handle(self, foo):
    self.output.out("foo CANNOT be empty")

class Che(Command):
  @args(Foo, remove="foo")
  def handle(self):
    self.output.out("foo CANNOT exist")