blackdoc tries to copy as much of the CLI of black as possible. This means that most calls to black can be directly translated to blackdoc:
To reformat specific files, use:
python -m blackdoc file1 file2 ...
while passing directories reformats all files in those directories that match the file format specified by --include
and --exclude
:
python -m blackdoc directory1 directory2 ...
mixing directories and files is also possible.
As an example, having a structure like:
directory
├── file.py
└── file.rst
with
directory/file.py
directory/file.rst
If we run
python -m blackdoc directory
we get
directory/reformatted.py
directory/reformatted.rst
If instead we run
python -m blackdoc --check directory
the result is:
would reformat directory/file.rst
would reformat directory/file.py
Oh no! 💥 💔 💥
2 files would be reformatted.
with a non-zero exit status.