Commit bf81c6fe authored by Bram Schoenmakers's avatar Bram Schoenmakers

Give command the ability to define its own set of flags.

parent 8d2fa4de
......@@ -40,12 +40,23 @@ class DCommand(Command):
except (InvalidCommandArgument, InvalidTodoException):
self.todo = None
def get_flags(self):
""" Default implementation of getting specific flags. """
return ("", [])
def process_flag(self):
""" Default implementation of processing specific flags. """
pass
def process_flags(self):
opts, args = self.getopt("f", ["force"])
opts, args = self.get_flags()
opts, args = self.getopt("f" + opts, ["force"] + args)
for opt, value in opts:
if opt == "-f" or opt == "--force":
self.force = True
else:
self.process_flag(opt, value)
self.args = args
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment