Merge branch 'arg_parse'

This commit is contained in:
Juke 2010-04-13 19:21:59 +02:00
commit 566e7acc01

View file

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
Copyright(C) 2010 Romain Bignon Copyright(C) 2010 Romain Bignon, Julien Hébert
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -85,7 +85,8 @@ class ConsoleApplication(BaseApplication):
nb_args = len(_args) - 1 nb_args = len(_args) - 1
if defaults: if defaults:
nb_args -= len(defaults) nb_args -= len(defaults)
if len(args) < nb_args or len(args) > nb_args and not varargs:
if len(args) < nb_args and not varargs:
if varargs: if varargs:
sys.stderr.write("Command '%s' takes at least %d arguments.\n" % (command, nb_args)) sys.stderr.write("Command '%s' takes at least %d arguments.\n" % (command, nb_args))
else: else: