- Auto-format a file or entire directory:
- Format the code passed in as a string:
black -c path/to/file_or_directory
- Output a diff for each file on stdout:
black --diff path/to/file_or_directory
- Return the status without writing the files back:
black --check path/to/file_or_directory
- Auto-format a file or directory emitting exclusively error messages to stderr:
black --quiet path/to/file_or_directory
black [Options] [SRC]...
The uncompromising code formatter.
- -l, --line-length INTEGER
How many character per line to allow. [default: 88]
Don't write the files back, just return the status. Return code 0 means nothing would change. Return code 1 means some files would be reformatted. Return code 123 means there was an internal error.
Don't write the files back, just output a diff for each file on stdout.
- --fast / --safe
If --fast given, skip temporary sanity checks. [default: --safe]
- -q, --quiet
Don't emit non-error messages to stderr. Errors are still emitted, silence those with 2>/dev/null.
Show the version and exit.