Allowing running management commands without colorized output
|Reported by:||josh@…||Owned by:||jose|
|Component:||Core (Management commands)||Version:||master|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Since the output style for a command is set as BaseCommand.style, and from call_command() you can only pass arguments into execute(), which does not expose any kind of style argument.
So as far as I can tell, there is no possible way to set style to django.core.management.color.no_style, and all of the SQL I am getting has color codes, making it fail to execute.
The only other alternative I can think of is to strip out the color codes after the fact, but that doesn't really seem like a clean option.
Maybe an option could be added for sqlflush? Or a style could be added to BaseCommand's default options similar to how it handles stdout and stdin?
Change History (11)
comment:1 Changed 3 years ago by claudep
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Accepted
comment:2 Changed 3 years ago by jose
- Owner changed from nobody to jose
- Status changed from new to assigned
comment:7 Changed 2 years ago by timo
- Summary changed from call_command provides no method to set output style to Allowing running management commands without colorized output
- Version changed from 1.4 to master
comment:9 Changed 2 years ago by Tim Graham <timograham@…>
- Resolution set to fixed
- Status changed from assigned to closed