I have built a command line python script using flask-script package to access an sql database that a regular APIRest service is managing via flask. I am having trouble setting parameters for my script commands. In particular:
a) How to set a default value within the @manager.options line
b) How to set a flag
I have tried something like the following:
@manager.option('-m', '--credit', dest='credit', default=-1, help='regular value')
@manager.option('--useCredit', dest='useCredit', default=False, help='boolean')
def newClient(credit=100, useCredit=False):
I managed to "hack" a default value by adding this to the function variable, but then I do not know what the "default" parameter is for in @manager.option? In addition, useCredit always asks me for a value, how can I make it a flag?
update
Thanks to @carlos answer I realized that I must had been testing it wrong, as it DOES work to set default parameters within the manager.option command. It seems that any values I place in the function definition (def newClient(credit=100, useCredit=False) are ignored. I would had expected some warning or error by the system...