Skip to content

Commit 42f91ed

Browse files
committed
Allow to add additional watch directories with glob patterns
1 parent fd726c5 commit 42f91ed

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

README.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ which can seen by running ``sphinx-autobuild --help``:
6666
--open-browser open the browser after building documentation
6767
--delay DELAY how long to wait before opening the browser
6868
--watch DIR additional directories to watch
69+
--watch-glob DIR_GLOB
70+
glob pattern for additional directories to watch
6971
--pre-build COMMAND additional command(s) to run prior to building the documentation
7072
--post-build COMMAND additional command(s) to run after building the documentation
7173

sphinx_autobuild/__main__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ def main(argv=()):
5858
)
5959

6060
watch_dirs = [src_dir] + args.additional_watched_dirs
61+
cwd = Path.cwd()
62+
for dir_glob in args.additional_watched_dir_globs:
63+
for directory in cwd.glob(dir_glob):
64+
if directory.is_dir():
65+
watch_dirs.append(directory.resolve())
6166
ignore_dirs = [
6267
".git",
6368
".hg",
@@ -231,6 +236,14 @@ def _add_autobuild_arguments(parser):
231236
help="additional directories to watch",
232237
dest="additional_watched_dirs",
233238
)
239+
group.add_argument(
240+
"--watch-glob",
241+
action="append",
242+
metavar="DIR_GLOB",
243+
default=[],
244+
help="glob pattern for additional directories to watch",
245+
dest="additional_watched_dir_globs",
246+
)
234247
group.add_argument(
235248
"--pre-build",
236249
action="append",

0 commit comments

Comments
 (0)