1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #25264 -- Allowed suppressing base command options in --help output.

This also suppresses -verbosity and --trackback options in the
runserver's help.
This commit is contained in:
Jan Szoja
2021-07-25 00:16:00 +01:00
committed by Mariusz Felisiak
parent 97f377cd35
commit b667ac24ea
6 changed files with 105 additions and 12 deletions

View File

@@ -0,0 +1,24 @@
from django.core.management import BaseCommand
class Command(BaseCommand):
help = 'Test suppress base options command.'
requires_system_checks = []
suppressed_base_arguments = {
'-v',
'--traceback',
'--settings',
'--pythonpath',
'--no-color',
'--force-color',
'--version',
'file',
}
def add_arguments(self, parser):
super().add_arguments(parser)
self.add_base_argument(parser, 'file', nargs='?', help='input file')
def handle(self, *labels, **options):
print('EXECUTE:SuppressBaseOptionsCommand options=%s' % sorted(options.items()))