Adding custom command requires code duplication from Command.handle() if one want to use options like verbosity.
|Reported by:||zimnyx||Owned by:||nobody|
|Component:||Core (Management commands)||Version:||master|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
# django/core/management/commands/test.py def handle(self, *test_labels, **options): # ... verbosity = int(options.get('verbosity', 1)) interactive = options.get('interactive', True) failfast = options.get('failfast', False) # ...
People who write custom commands make use of options like verbosity, etc.
This code should be moved to separate function setup_options(), so people who write custom command don't have to "copy&paste" that code into their' CustomCommand.handle() implementation.
Change History (7)
comment:1 Changed 3 years ago by russellm
- Component changed from Uncategorized to Core framework
- milestone set to 2.0
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Accepted