From 1bbca7961cee20c4ddd453a7d74d316e84f4bbb5 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Mon, 7 Sep 2015 15:17:55 +0200 Subject: [PATCH] Fixed #25350 -- Added alias --no-input for --noinput to management commands. --- django/contrib/auth/management/commands/createsuperuser.py | 3 ++- .../staticfiles/management/commands/collectstatic.py | 2 +- django/core/management/commands/flush.py | 3 ++- django/core/management/commands/makemigrations.py | 3 ++- django/core/management/commands/migrate.py | 3 ++- django/core/management/commands/squashmigrations.py | 3 ++- django/core/management/commands/test.py | 2 +- django/core/management/commands/testserver.py | 3 ++- docs/ref/contrib/staticfiles.txt | 7 ++++++- docs/ref/django-admin.txt | 7 ++++++- docs/releases/1.9.txt | 3 +++ 11 files changed, 29 insertions(+), 10 deletions(-) diff --git a/django/contrib/auth/management/commands/createsuperuser.py b/django/contrib/auth/management/commands/createsuperuser.py index 558ee64d9f..56461cedfa 100644 --- a/django/contrib/auth/management/commands/createsuperuser.py +++ b/django/contrib/auth/management/commands/createsuperuser.py @@ -33,7 +33,8 @@ class Command(BaseCommand): parser.add_argument('--%s' % self.UserModel.USERNAME_FIELD, dest=self.UserModel.USERNAME_FIELD, default=None, help='Specifies the login for the superuser.') - parser.add_argument('--noinput', action='store_false', dest='interactive', default=True, + parser.add_argument('--noinput', '--no-input', + action='store_false', dest='interactive', default=True, help=('Tells Django to NOT prompt the user for input of any kind. ' 'You must use --%s with --noinput, along with an option for ' 'any other required field. Superusers created with --noinput will ' diff --git a/django/contrib/staticfiles/management/commands/collectstatic.py b/django/contrib/staticfiles/management/commands/collectstatic.py index 2d45648ba9..523f313c13 100644 --- a/django/contrib/staticfiles/management/commands/collectstatic.py +++ b/django/contrib/staticfiles/management/commands/collectstatic.py @@ -36,7 +36,7 @@ class Command(BaseCommand): self.local = True def add_arguments(self, parser): - parser.add_argument('--noinput', + parser.add_argument('--noinput', '--no-input', action='store_false', dest='interactive', default=True, help="Do NOT prompt the user for input of any kind.") parser.add_argument('--no-post-process', diff --git a/django/core/management/commands/flush.py b/django/core/management/commands/flush.py index 840c78486a..018c12ed96 100644 --- a/django/core/management/commands/flush.py +++ b/django/core/management/commands/flush.py @@ -17,7 +17,8 @@ class Command(BaseCommand): 'migrations. Does not achieve a "fresh install" state.') def add_arguments(self, parser): - parser.add_argument('--noinput', action='store_false', dest='interactive', default=True, + parser.add_argument('--noinput', '--no-input', + action='store_false', dest='interactive', default=True, help='Tells Django to NOT prompt the user for input of any kind.') parser.add_argument('--database', action='store', dest='database', default=DEFAULT_DB_ALIAS, diff --git a/django/core/management/commands/makemigrations.py b/django/core/management/commands/makemigrations.py index da5a2bd257..d6af5cd4dc 100644 --- a/django/core/management/commands/makemigrations.py +++ b/django/core/management/commands/makemigrations.py @@ -29,7 +29,8 @@ class Command(BaseCommand): help="Enable fixing of migration conflicts.") parser.add_argument('--empty', action='store_true', dest='empty', default=False, help="Create an empty migration.") - parser.add_argument('--noinput', action='store_false', dest='interactive', default=True, + parser.add_argument('--noinput', '--no-input', + action='store_false', dest='interactive', default=True, help='Tells Django to NOT prompt the user for input of any kind.') parser.add_argument('-n', '--name', action='store', dest='name', default=None, help="Use this name for migration file(s).") diff --git a/django/core/management/commands/migrate.py b/django/core/management/commands/migrate.py index 03e2a37ab1..9aa9c44206 100644 --- a/django/core/management/commands/migrate.py +++ b/django/core/management/commands/migrate.py @@ -33,7 +33,8 @@ class Command(BaseCommand): 'migration. Use the name "zero" to unapply all migrations.' ), ) - parser.add_argument('--noinput', action='store_false', dest='interactive', default=True, + parser.add_argument('--noinput', '--no-input', + action='store_false', dest='interactive', default=True, help='Tells Django to NOT prompt the user for input of any kind.') parser.add_argument('--database', action='store', dest='database', default=DEFAULT_DB_ALIAS, help='Nominates a database to synchronize. ' diff --git a/django/core/management/commands/squashmigrations.py b/django/core/management/commands/squashmigrations.py index db55195187..39225c2d75 100644 --- a/django/core/management/commands/squashmigrations.py +++ b/django/core/management/commands/squashmigrations.py @@ -19,7 +19,8 @@ class Command(BaseCommand): help='Migrations will be squashed until and including this migration.') parser.add_argument('--no-optimize', action='store_true', dest='no_optimize', default=False, help='Do not try to optimize the squashed operations.') - parser.add_argument('--noinput', action='store_false', dest='interactive', default=True, + parser.add_argument('--noinput', '--no-input', + action='store_false', dest='interactive', default=True, help='Tells Django to NOT prompt the user for input of any kind.') def handle(self, **options): diff --git a/django/core/management/commands/test.py b/django/core/management/commands/test.py index 127ed5c846..0d084e1e91 100644 --- a/django/core/management/commands/test.py +++ b/django/core/management/commands/test.py @@ -32,7 +32,7 @@ class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument('args', metavar='test_label', nargs='*', help='Module paths to test; can be modulename, modulename.TestCase or modulename.TestCase.test_method') - parser.add_argument('--noinput', + parser.add_argument('--noinput', '--no-input', action='store_false', dest='interactive', default=True, help='Tells Django to NOT prompt the user for input of any kind.'), parser.add_argument('--failfast', diff --git a/django/core/management/commands/testserver.py b/django/core/management/commands/testserver.py index a629e7285a..3c14b26181 100644 --- a/django/core/management/commands/testserver.py +++ b/django/core/management/commands/testserver.py @@ -11,7 +11,8 @@ class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument('args', metavar='fixture', nargs='*', help='Path(s) to fixtures to load before running the server.') - parser.add_argument('--noinput', action='store_false', dest='interactive', default=True, + parser.add_argument('--noinput', '--no-input', + action='store_false', dest='interactive', default=True, help='Tells Django to NOT prompt the user for input of any kind.') parser.add_argument('--addrport', default='', help='Port number or ipaddr:port to run the server on.') diff --git a/docs/ref/contrib/staticfiles.txt b/docs/ref/contrib/staticfiles.txt index ee11ac88d9..010eacccce 100644 --- a/docs/ref/contrib/staticfiles.txt +++ b/docs/ref/contrib/staticfiles.txt @@ -90,7 +90,12 @@ Some commonly used options are: .. django-admin-option:: --noinput - Do NOT prompt the user for input of any kind. + Do NOT prompt the user for input of any kind. You can use ``--no-input`` + as an alias for this option. + + .. versionchanged:: 1.9 + + The ``--no-input`` alias was added. .. django-admin-option:: -i .. django-admin-option:: --ignore diff --git a/docs/ref/django-admin.txt b/docs/ref/django-admin.txt index 94b12fe9d7..35a02eecc8 100644 --- a/docs/ref/django-admin.txt +++ b/docs/ref/django-admin.txt @@ -1552,7 +1552,12 @@ If not provided all locales are processed. Use the ``--noinput`` option to suppress all user prompting, such as "Are you sure?" confirmation messages. This is useful if ``django-admin`` is -being executed as an unattended, automated script. +being executed as an unattended, automated script. You can use ``--no-input`` +as an alias for this option. + +.. versionchanged:: 1.9 + + The ``--no-input`` alias was added. Extra niceties ============== diff --git a/docs/releases/1.9.txt b/docs/releases/1.9.txt index f93b403552..2bf591b8b0 100644 --- a/docs/releases/1.9.txt +++ b/docs/releases/1.9.txt @@ -418,6 +418,9 @@ Management Commands * The ``django`` package may be run as a script, i.e. ``python -m django``, which will behave the same as ``django-admin``. +* Management commands that have the ``--noinput`` option now also take + ``--no-input`` as an alias for that option. + Migrations ^^^^^^^^^^