smurfix/flask-script

sub-managers show Manager docstring when usage not set

davidism opened this issue · 1 comments

manager = Manager(app)
sub = Manager()  # or description=
manager.add_command('sub', sub)

Running this shows the docstring for Manager as the description.

$ ./manage.py --help
...
sub              Controller class for handling a set of commands.
                    Typical usage:: class Print(Command): def run(self):
                    print "hello" app = Flask(__name__) manager =
                    Manager(app) manager.add_command("print", Print()) if
                    __name__ == "__main__": manager.run() On command
                    line:: python manage.py print > hello :param app:
                    Flask instance, or callable returning a Flask
                    instance. :param with_default_commands: load commands
                    **runserver** and **shell** by default. :param
                    disable_argcomplete: disable automatic loading of
                    argcomplete.
...

If you set usage=, then the message is correct here, but the usage message from ./manage.py sub --help is wrong (because you just overrode it).

If you set description=, then the message is wrong here, but usage and description are correct for the sub-help.

If you set help=, the the message is correct here, but the description is the docstring for Manager again.

I'm not sure if this is a bug because you can set both help= and description= and then everything looks right, but this is not clear from the docs. The API section doesn't describe them, the sub-manager example doesn't set any of them, and the developer section shows setting usage=, which hides the real usage.

Issue still present in version 2.0.6