Fixed #983 -- Made 'django-admin.py --help' output easier to read. Thanks, Oliver
git-svn-id: http://code.djangoproject.com/svn/django/trunk@1526 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
2863e09f2e
commit
027c47b9b4
1
AUTHORS
1
AUTHORS
|
@ -76,6 +76,7 @@ answer newbie questions, and generally made Django that much better:
|
||||||
Luke Plant <http://lukeplant.me.uk/>
|
Luke Plant <http://lukeplant.me.uk/>
|
||||||
phaedo <http://phaedo.cx/>
|
phaedo <http://phaedo.cx/>
|
||||||
plisk
|
plisk
|
||||||
|
Oliver Rutherfurd <http://rutherfurd.net/>
|
||||||
David Schein
|
David Schein
|
||||||
sopel
|
sopel
|
||||||
Radek Švarz <http://www.svarz.cz/translate/>
|
Radek Švarz <http://www.svarz.cz/translate/>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
from django.core import management
|
from django.core import management
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
import os, sys
|
import os, sys, textwrap
|
||||||
|
|
||||||
ACTION_MAPPING = {
|
ACTION_MAPPING = {
|
||||||
'adminindex': management.get_admin_index,
|
'adminindex': management.get_admin_index,
|
||||||
|
@ -37,8 +37,10 @@ def get_usage():
|
||||||
available_actions.sort()
|
available_actions.sort()
|
||||||
for a in available_actions:
|
for a in available_actions:
|
||||||
func = ACTION_MAPPING[a]
|
func = ACTION_MAPPING[a]
|
||||||
usage.append(" %s %s -- %s" % (a, func.args, getattr(func, 'help_doc', func.__doc__)))
|
usage.append(" %s %s" % (a, func.args))
|
||||||
return '\n'.join(usage)
|
usage.extend(textwrap.wrap(getattr(func, 'help_doc', func.__doc__), initial_indent=' ', subsequent_indent=' '))
|
||||||
|
usage.append("")
|
||||||
|
return '\n'.join(usage[:-1]) # Cut off last list element, an empty space.
|
||||||
|
|
||||||
class DjangoOptionParser(OptionParser):
|
class DjangoOptionParser(OptionParser):
|
||||||
def print_usage_and_exit(self):
|
def print_usage_and_exit(self):
|
||||||
|
|
Loading…
Reference in New Issue