Fixed some documentation strings in django-admin, and updated the bash completion script.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5245 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee 2007-05-15 11:39:00 +00:00
parent b996e214c0
commit a10e73ac30
2 changed files with 34 additions and 34 deletions

View File

@ -578,7 +578,7 @@ def syncdb(verbosity=1, interactive=True):
# Install the 'initialdata' fixture, using format discovery # Install the 'initialdata' fixture, using format discovery
load_data(['initial_data'], verbosity=verbosity) load_data(['initial_data'], verbosity=verbosity)
syncdb.help_doc = "Create the database tables for all apps in INSTALLED_APPS whose tables haven't already been created." syncdb.help_doc = "Create the database tables for all apps in INSTALLED_APPS whose tables haven't already been created."
syncdb.args = '[--verbosity] [--interactive]' syncdb.args = '[--verbosity] [--noinput]'
def get_admin_index(app): def get_admin_index(app):
"Returns admin-index template snippet (in list form) for the given app." "Returns admin-index template snippet (in list form) for the given app."
@ -672,7 +672,7 @@ The full error: """ % (app_name, app_name)) + style.ERROR_OUTPUT(str(e)) + '\n')
else: else:
print "Reset cancelled." print "Reset cancelled."
reset.help_doc = "Executes ``sqlreset`` for the given app(s) in the current database." reset.help_doc = "Executes ``sqlreset`` for the given app(s) in the current database."
reset.args = '[--interactive]' + APP_ARGS reset.args = '[--noinput]' + APP_ARGS
def flush(verbosity=1, interactive=True): def flush(verbosity=1, interactive=True):
"Returns all tables in the database to the same state they were in immediately after syncdb." "Returns all tables in the database to the same state they were in immediately after syncdb."
@ -733,7 +733,7 @@ The full error: """ % settings.DATABASE_NAME + style.ERROR_OUTPUT(str(e)) + '\n'
else: else:
print "Flush cancelled." print "Flush cancelled."
flush.help_doc = "Executes ``sqlflush`` on the current database." flush.help_doc = "Executes ``sqlflush`` on the current database."
flush.args = '[--verbosity] [--interactive]' flush.args = '[--verbosity] [--noinput]'
def _start_helper(app_or_project, name, directory, other_name=''): def _start_helper(app_or_project, name, directory, other_name=''):
other = {'project': 'app', 'app': 'project'}[app_or_project] other = {'project': 'app', 'app': 'project'}[app_or_project]
@ -1452,7 +1452,7 @@ def dump_data(app_labels, format='json', indent=None):
except Exception, e: except Exception, e:
sys.stderr.write(style.ERROR("Unable to serialize database: %s\n" % e)) sys.stderr.write(style.ERROR("Unable to serialize database: %s\n" % e))
dump_data.help_doc = 'Output the contents of the database as a fixture of the given format' dump_data.help_doc = 'Output the contents of the database as a fixture of the given format'
dump_data.args = '[--format]' + APP_ARGS dump_data.args = '[--format] [--indent]' + APP_ARGS
# Utilities for command-line script # Utilities for command-line script

View File

@ -42,13 +42,13 @@ _django_completion()
prev="${COMP_WORDS[COMP_CWORD-1]}" prev="${COMP_WORDS[COMP_CWORD-1]}"
# Standalone options # Standalone options
opts="--help --settings --pythonpath --version" opts="--help --settings --pythonpath --noinput --noreload --format --indent --verbosity --adminmedia --version"
# Actions # Actions
actions="adminindex createcachetable dbshell diffsettings \ actions="adminindex createcachetable dbshell diffsettings \
inspectdb install reset runfcgi runserver \ dumpdata flush inspectdb loaddata reset runfcgi runserver \
shell sql sqlall sqlclear sqlindexes sqlinitialdata \ shell sql sqlall sqlclear sqlcustom sqlflush sqlindexes \
sqlreset sqlsequencereset startapp startproject \ sqlreset sqlsequencereset startapp startproject \
syncdb validate" syncdb test validate"
# Action's options # Action's options
action_shell_opts="--plain" action_shell_opts="--plain"
action_runfcgi_opts="host port socket method maxspare minspare maxchildren daemonize pidfile workdir" action_runfcgi_opts="host port socket method maxspare minspare maxchildren daemonize pidfile workdir"
@ -84,33 +84,33 @@ _django_completion()
esac esac
else else
case ${prev} in case ${prev} in
adminindex|install|reset| \ adminindex|dumpdata|reset| \
sql|sqlall|sqlclear|sqlindexes| \ sql|sqlall|sqlclear|sqlcustom|sqlindexes| \
sqlinitialdata|sqlreset|sqlsequencereset) sqlreset|sqlsequencereset|test)
# App completion # App completion
settings="" settings=""
# If settings.py in the PWD, use that # If settings.py in the PWD, use that
if [ -e settings.py ] ; then if [ -e settings.py ] ; then
settings="$PWD/settings.py" settings="$PWD/settings.py"
else else
# Use the ENV variable if it is set # Use the ENV variable if it is set
if [ $DJANGO_SETTINGS_MODULE ] ; then if [ $DJANGO_SETTINGS_MODULE ] ; then
settings=$DJANGO_SETTINGS_MODULE settings=$DJANGO_SETTINGS_MODULE
fi
fi fi
fi # Couldn't find settings so return nothing
# Couldn't find settings so return nothing if [ -z $settings ] ; then
if [ -z $settings ] ; then COMPREPLY=()
COMPREPLY=() # Otherwise inspect settings.py file
# Otherwise inspect settings.py file else
else apps=`sed -n "/INSTALLED_APPS = (/,/)/p" $settings | \
apps=`sed -n "/INSTALLED_APPS = (/,/)/p" $settings | \ grep -v "django.contrib" |
grep -v "django.contrib" | sed -n "s/^[ ]*'\(.*\.\)*\(.*\)'.*$/\2 /pg" | \
sed -n "s/^[ ]*'\(.*\.\)*\(.*\)'.*$/\2 /pg" | \ tr -d "\n"`
tr -d "\n"` COMPREPLY=( $(compgen -W "${apps}" -- ${cur}) )
COMPREPLY=( $(compgen -W "${apps}" -- ${cur}) ) fi
fi return 0
return 0 ;;
;;
createcachetable|dbshell|diffsettings| \ createcachetable|dbshell|diffsettings| \
inspectdb|runserver|startapp|startproject|syncdb| \ inspectdb|runserver|startapp|startproject|syncdb| \