added help message to django.generate

This commit is contained in:
Ronny Abraham 2018-10-16 03:42:26 +03:00
parent 4ccbe25f25
commit 33b11f3df8

View file

@ -380,7 +380,7 @@ def generate_scripts(template_name, make_copy=False):
@task @task
def generate(param=None, make_copy=False): def generate(param="help", make_copy=False):
""" """
param can be one of settings, local, wsgi param can be one of settings, local, wsgi
make_copy must be set to True if you want it to actually do anthing make_copy must be set to True if you want it to actually do anthing
@ -392,10 +392,26 @@ def generate(param=None, make_copy=False):
make_copy = booleanize(make_copy) make_copy = booleanize(make_copy)
if param and param not in PARAM_LIST: if param:
err_msg = None
if param == "help":
err_msg = """
fab django.generate:param="help",make_copy=False
param - file to be generated can be of type: %s
make_copy - determines whether or generate copies the generated file
into it's practical location (otherwise doesn't do anything)
""" % PARAM_LIST
elif param not in PARAM_LIST:
err_msg = "You asked to generate %s, that value isn't available" \ err_msg = "You asked to generate %s, that value isn't available" \
" possible script values available: %s" % (param, PARAM_LIST) " possible script values available: %s" % (param, PARAM_LIST)
if err_msg:
import sys import sys
sys.exit(err_msg) sys.exit(err_msg)