|
1 | 1 | """Snooty. |
2 | 2 |
|
3 | 3 | Usage: |
4 | | - snooty build [--no-caching] <source-path> [<mongodb-url>] [--commit=<commit_hash> | (--commit=<commit_hash> --patch=<patch_id>)] |
| 4 | + snooty build [--no-caching] <source-path> [<mongodb-url>] [options] |
5 | 5 | snooty watch [--no-caching] <source-path> |
6 | 6 | snooty [--no-caching] language-server |
7 | 7 |
|
|
10 | 10 | --commit=<commit_hash> Commit hash of build. |
11 | 11 | --patch=<patch_id> Patch ID of build. Must be specified with a commit hash. |
12 | 12 | --no-caching Disable HTTP response caching. |
| 13 | + --rstspec=<url> Override the reStructuredText directive & role spec. |
13 | 14 |
|
14 | 15 | Environment variables: |
15 | 16 | SNOOTY_PARANOID 0, 1 where 0 is default |
|
34 | 35 | import watchdog.observers |
35 | 36 | from docopt import docopt |
36 | 37 |
|
37 | | -from . import __version__, language_server |
| 38 | +from . import __version__, language_server, specparser |
38 | 39 | from .diagnostics import Diagnostic, MakeCorrectionMixin |
39 | 40 | from .page import Page |
40 | 41 | from .parser import Project, ProjectBackend |
@@ -280,6 +281,15 @@ def main() -> None: |
280 | 281 |
|
281 | 282 | logger.info(f"Snooty {__version__} starting") |
282 | 283 |
|
| 284 | + if args["--rstspec"]: |
| 285 | + rstspec_path = args["--rstspec"] |
| 286 | + if rstspec_path.startswith("https://") or rstspec_path.startswith("http://"): |
| 287 | + rstspec_bytes = HTTPCache.singleton().get(args["--rstspec"]) |
| 288 | + rstspec_text = str(rstspec_bytes, "utf-8") |
| 289 | + else: |
| 290 | + rstspec_text = Path(rstspec_path).read_text(encoding="utf-8") |
| 291 | + specparser.Spec.initialize(rstspec_text) |
| 292 | + |
283 | 293 | if PARANOID_MODE: |
284 | 294 | logger.info("Paranoid mode on") |
285 | 295 |
|
|
0 commit comments