Commit 8d2fa4de authored by Bram Schoenmakers's avatar Bram Schoenmakers

Get rid of argument_shift.

parent ac61e8e6
...@@ -28,8 +28,7 @@ class Command(object): ...@@ -28,8 +28,7 @@ class Command(object):
Sets up the basic properties for executing a subcommand. Sets up the basic properties for executing a subcommand.
p_args is a list of arguments that can be passed to this subcommand. p_args is a list of arguments that can be passed to this subcommand.
These can be retrieved with argument(), or the existence of an argument These can be retrieved with argument().
using argument_shift().
p_todolist is a reference to the todolist instance to operate on. p_todolist is a reference to the todolist instance to operate on.
...@@ -55,7 +54,7 @@ class Command(object): ...@@ -55,7 +54,7 @@ class Command(object):
Execute the command. Intercepts the help subsubcommand to show the help Execute the command. Intercepts the help subsubcommand to show the help
text. text.
""" """
if self.argument_shift("help"): if self.args and self.argument(0) == "help":
self.error(self.usage() + "\n\n" + self.help()) self.error(self.usage() + "\n\n" + self.help())
return False return False
...@@ -71,16 +70,6 @@ class Command(object): ...@@ -71,16 +70,6 @@ class Command(object):
return value return value
def argument_shift(self, p_expr):
"""
Returns true when the first argument equals the given expression.
"""
if len(self.args) and self.argument(0) == p_expr:
del self.args[0]
return True
return False
def getopt(self, p_flags, p_long=[]): def getopt(self, p_flags, p_long=[]):
try: try:
result = getopt.getopt(self.args, p_flags, p_long) result = getopt.getopt(self.args, p_flags, p_long)
......
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