Opened 7 years ago

Closed 4 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: burzak Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

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@…> 7 years ago.
django-admin-stdout2011.diff (1.4 KB) - added by burzak 4 years ago.
The patch was outdated. I updated this to the latest version.
django-admin-stdout_with_test.diff (2.2 KB) - added by burzak 4 years ago.
Print just help info to stdout, print real errors to stderr. Fixed tests

Download all attachments as: .zip

Change History (8)

Changed 7 years ago by Petr Marhoun <petr.marhoun@…>

comment:1 Changed 7 years ago by ericholscher

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Changed 4 years ago by burzak

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

comment:2 Changed 4 years ago by burzak

  • Cc burzak added

comment:3 Changed 4 years ago by ramiro

  • Patch needs improvement set

Changed 4 years ago by burzak

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

comment:4 Changed 4 years ago by burzak

  • Patch needs improvement unset

comment:5 Changed 4 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

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