fix: when there are no args, return [] instead of ['']
This commit is contained in:
parent
9a8fe8b55e
commit
8c7da03c60
1 changed files with 6 additions and 2 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue