Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ which can seen by running ``sphinx-autobuild --help``:
--open-browser open the browser after building documentation
--delay DELAY how long to wait before opening the browser
--watch DIR additional directories to watch
--watch-glob DIR_GLOB
glob pattern for additional directories to watch
--pre-build COMMAND additional command(s) to run prior to building the documentation
--post-build COMMAND additional command(s) to run after building the documentation

Expand Down
13 changes: 13 additions & 0 deletions sphinx_autobuild/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ def main(argv=()):
)

watch_dirs = [src_dir] + args.additional_watched_dirs
cwd = Path.cwd()
for dir_glob in args.additional_watched_dir_globs:
for directory in cwd.glob(dir_glob):
if directory.is_dir():
watch_dirs.append(directory.resolve())
ignore_dirs = [
".git",
".hg",
Expand Down Expand Up @@ -231,6 +236,14 @@ def _add_autobuild_arguments(parser):
help="additional directories to watch",
dest="additional_watched_dirs",
)
group.add_argument(
"--watch-glob",
action="append",
metavar="DIR_GLOB",
default=[],
help="glob pattern for additional directories to watch",
dest="additional_watched_dir_globs",
)
group.add_argument(
"--pre-build",
action="append",
Expand Down