Opened 16 years ago

Closed 14 years ago

#9158 closed (fixed)

django-admin.py print help to stderr

Reported by: Petr Marhoun <petr.marhoun@…> Owned by: nobody
Component: Core (Management commands) Version: 1.0
Severity: Keywords:
Cc: Dario Ocles Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Command django-admin.py help print this text to stdout:

Usage: django-admin.py subcommand [options] [args]

Options:
  --settings=SETTINGS   The Python path to a settings module, e.g.
                        "myproject.settings.main". If this isn't provided, the
                        DJANGO_SETTINGS_MODULE environment variable will be
                        used.
  --pythonpath=PYTHONPATH
                        A directory to add to the Python path, e.g.
                        "/home/djangoprojects/myproject".
  --traceback           Print traceback on exception
  --version             show program's version number and exit
  -h, --help            show this help message and exit

and this text to stderr:

Type 'django-admin.py help <subcommand>' for help on a specific subcommand.

Available subcommands:
  cleanup
  compilemessages
  createcachetable
  dbshell
  diffsettings
  dumpdata
  flush
  inspectdb
  loaddata
  makemessages
  reset
  runfcgi
  runserver
  shell
  sql
  sqlall
  sqlclear
  sqlcustom
  sqlflush
  sqlindexes
  sqlinitialdata
  sqlreset
  sqlsequencereset
  startapp
  startproject
  syncdb
  test
  testserver
  validate

It is quite illogical. And it is not possible to do something as it:

django-admin.py help | grep sql

(It is also useful if there are some custom commands with common prefix and I want their list.)

Attached patch replaces all four occurrences in django.core.management.init from stderr to stdout. But the first and the second are real errors, patch with only the third and the fourth change could be better.

Attachments (3)

django-admin-stdout.diff (1.6 KB ) - added by Petr Marhoun <petr.marhoun@…> 16 years ago.
django-admin-stdout2011.diff (1.4 KB ) - added by Dario Ocles 14 years ago.
The patch was outdated. I updated this to the latest version.
django-admin-stdout_with_test.diff (2.2 KB ) - added by Dario Ocles 14 years ago.
Print just help info to stdout, print real errors to stderr. Fixed tests

Download all attachments as: .zip

Change History (8)

by Petr Marhoun <petr.marhoun@…>, 16 years ago

Attachment: django-admin-stdout.diff added

comment:1 by Eric Holscher, 16 years ago

Triage Stage: UnreviewedAccepted

by Dario Ocles, 14 years ago

The patch was outdated. I updated this to the latest version.

comment:2 by Dario Ocles, 14 years ago

Cc: Dario Ocles added

comment:3 by Ramiro Morales, 14 years ago

Patch needs improvement: set

by Dario Ocles, 14 years ago

Print just help info to stdout, print real errors to stderr. Fixed tests

comment:4 by Dario Ocles, 14 years ago

Patch needs improvement: unset

comment:5 by Adrian Holovaty, 14 years ago

Resolution: fixed
Status: newclosed

In [15921]:

Fixed #9158 -- Changed django-admin.py help to be printed to stdout instead of stderr, so that it's more easily greppable. Thanks, petr.marhoun@…

Note: See TracTickets for help on using tickets.
Back to Top