flask-script icon indicating copy to clipboard operation
flask-script copied to clipboard

Make available commands configurable

Open italomaia opened this issue 8 years ago • 1 comments

Today, I was trying to handle configurable extensions commands availability. That is, I want to be able to add commands to my manager based on the available extensions configured with my application.

The thing is, I only know which commands are to be loaded after my Flask instance was created. If it was possible to have the Flask instance created before processing commands, I could load the "dynamic" commands, per extension, with easy.

italomaia avatar Sep 26 '16 01:09 italomaia

This is easy as long as you don't use a decorator. I.e. instead of

@manager.command
def do_thing(parameter)

you declare the function in one place and when you're ready, do a

if ('something' in app):
   manager.command(do_thing)

yv avatar Mar 11 '17 11:03 yv