From 33b11f3df845be911238ee95a3b6d698c2f93601 Mon Sep 17 00:00:00 2001 From: Ronny Abraham Date: Tue, 16 Oct 2018 03:42:26 +0300 Subject: [PATCH] added help message to django.generate --- modules/django.py | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/modules/django.py b/modules/django.py index b9290ad..4d9af9b 100644 --- a/modules/django.py +++ b/modules/django.py @@ -380,7 +380,7 @@ def generate_scripts(template_name, make_copy=False): @task -def generate(param=None, make_copy=False): +def generate(param="help", make_copy=False): """ param can be one of settings, local, wsgi make_copy must be set to True if you want it to actually do anthing @@ -392,12 +392,28 @@ def generate(param=None, make_copy=False): make_copy = booleanize(make_copy) - if param and param not in PARAM_LIST: - err_msg = "You asked to generate %s, that value isn't available" \ - " possible script values available: %s" % (param, PARAM_LIST) + if param: - import sys - sys.exit(err_msg) + 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" \ + " possible script values available: %s" % (param, PARAM_LIST) + + if err_msg: + import sys + sys.exit(err_msg) print("django:generate make_copy : %s\n" % make_copy) print("django:generate script : %s" % param)