Skip to content

Commit 23207e0

Browse files
committed
Run directivegetter on sphinx-lint init directives sourcedir builddir
1 parent efd70d2 commit 23207e0

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

directivegetter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ def setup(app: Sphinx) -> dict[str, bool]:
6262
return {"parallel_read_safe": True, "parallel_write_safe": True}
6363

6464

65-
def collect_directives():
65+
def collect_directives(args=None):
6666
from sphinx import application
6767
from sphinx.application import Sphinx
6868

6969
try:
70-
source_dir, build_dir, *opts = sys.argv[1:]
70+
source_dir, build_dir, *opts = args or sys.argv[1:]
7171
except ValueError:
7272
raise RuntimeError("Two arguments (source dir and build dir) are required.")
7373

sphinxlint.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,11 @@ def check_block(block_lineno, block):
451451
def parse_args(argv=None):
452452
if argv is None:
453453
argv = sys.argv
454+
if argv[1:2] == ["init", "directives"]:
455+
from directivegetter import collect_directives
456+
457+
raise SystemExit(collect_directives(sys.argv[2:]))
458+
454459
parser = argparse.ArgumentParser(description=__doc__)
455460
parser.add_argument(
456461
"-v",

0 commit comments

Comments
 (0)