Skip to content

Commit 002d1fa

Browse files
authored
Fixes for the doc-builder style command (#157)
* Fixes for the doc-builder style command * Remove debug error
1 parent 05a27a9 commit 002d1fa

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/doc_builder/commands/style.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@
1717
import argparse
1818

1919
from doc_builder import style_doc_files
20+
from doc_builder.utils import read_doc_config
2021

2122

2223
def style_command(args):
24+
if args.path_to_docs is not None:
25+
read_doc_config(args.path_to_docs)
2326
changed = style_doc_files(*args.files, max_len=args.max_len, check_only=args.check_only)
2427
if args.check_only and len(changed) > 0:
2528
raise ValueError(f"{len(changed)} files should be restyled!")
@@ -34,6 +37,7 @@ def style_command_parser(subparsers=None):
3437
parser = argparse.ArgumentParser("Doc Builder style command")
3538

3639
parser.add_argument("files", nargs="+", help="The file(s) or folder(s) to restyle.")
40+
parser.add_argument("--path_to_docs", type=str, help="The path to the doc source folder if using the config.")
3741
parser.add_argument("--max_len", type=int, default=119, help="The maximum length of lines.")
3842
parser.add_argument("--check_only", action="store_true", help="Whether to only check and not fix styling issues.")
3943

src/doc_builder/style_doc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
def get_black_avoid_patterns():
4141
patterns = {"===PT-TF-SPLIT===": "### PT-TF-SPLIT"}
42-
doc_config = get_doc_config
42+
doc_config = get_doc_config()
4343
if doc_config is not None and hasattr(doc_config, "black_avoid_patterns"):
4444
patterns.update(doc_config.black_avoid_patterns)
4545
return patterns

0 commit comments

Comments
 (0)