summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/core/management/__init__.py2
-rw-r--r--tests/regressiontests/admin_scripts/tests.py10
2 files changed, 11 insertions, 1 deletions
diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py
index 85bf324fdc..bafab17112 100644
--- a/django/core/management/__init__.py
+++ b/django/core/management/__init__.py
@@ -372,7 +372,7 @@ class ManagementUtility(object):
elif self.argv[1:] == ['--version']:
# LaxOptionParser already takes care of printing the version.
pass
- elif self.argv[1:] == ['--help']:
+ elif self.argv[1:] in (['--help'], ['-h']):
parser.print_lax_help()
sys.stderr.write(self.main_help_text() + '\n')
else:
diff --git a/tests/regressiontests/admin_scripts/tests.py b/tests/regressiontests/admin_scripts/tests.py
index 2a7f3023c1..b3e826f74b 100644
--- a/tests/regressiontests/admin_scripts/tests.py
+++ b/tests/regressiontests/admin_scripts/tests.py
@@ -1031,6 +1031,16 @@ class CommandTypes(AdminScriptTestCase):
self.assertOutput(out, "Usage: manage.py subcommand [options] [args]")
self.assertOutput(err, "Type 'manage.py help <subcommand>' for help on a specific subcommand.")
+ def test_short_help(self):
+ "-h is handled as a short form of --help"
+ args = ['-h']
+ out, err = self.run_manage(args)
+ if sys.version_info < (2, 5):
+ self.assertOutput(out, "usage: manage.py subcommand [options] [args]")
+ else:
+ self.assertOutput(out, "Usage: manage.py subcommand [options] [args]")
+ self.assertOutput(err, "Type 'manage.py help <subcommand>' for help on a specific subcommand.")
+
def test_specific_help(self):
"--help can be used on a specific command"
args = ['sqlall','--help']