Command.params are now sorted the same way as Object.params (make user-add prompt for first, last before login)

This commit is contained in:
Jason Gerard DeRose 2008-10-13 21:53:03 -06:00
parent b6dcd183a6
commit 2357360e2a

View File

@ -687,8 +687,15 @@ class Command(plugable.Plugin):
(create_param(spec) for spec in self.get_options()),
sort=False
)
def get_key(p):
if p.required:
if p.default_from is None:
return 0
return 1
return 2
self.params = plugable.NameSpace(
tuple(self.args()) + tuple(self.options()), sort=False
sorted(tuple(self.args()) + tuple(self.options()), key=get_key),
sort=False
)
super(Command, self).finalize()