fix: when there are no args, return [] instead of ['']

This commit is contained in:
Romain Bignon 2010-11-11 13:57:25 +01:00
commit 8c7da03c60

View file

@ -334,8 +334,12 @@ class ReplApplication(Cmd, BaseApplication):
logging.error(e)
def parseargs(self, line, nb, req_n=None):
args = line.strip().split(' ', nb - 1)
if req_n is not None and (len(args) < req_n or req_n < 2 and line == ''):
if line.strip() == '':
# because ''.split() = ['']
args = []
else:
args = line.strip().split(' ', nb - 1)
if req_n is not None and (len(args) < req_n):
raise NotEnoughArguments('Command needs %d arguments' % req_n)
if len(args) < nb: