Skip to content

Commit

Permalink
Add ability to lookup via CLI.
Browse files Browse the repository at this point in the history
    python -m intersphinx_registry.lookup [package names]

Not direction -m intersphinx_registry in case we want to add
functionalities later.
  • Loading branch information
Carreau committed Jun 3, 2024
1 parent e2b4914 commit 1fa733e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions intersphinx_registry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

from __future__ import annotations

import sys

from pathlib import Path
import json
from typing import Dict, Tuple, Set, Optional, cast
Expand Down
20 changes: 20 additions & 0 deletions intersphinx_registry/lookup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import sys

from intersphinx_registry import get_intersphinx_mapping
from sphinx.ext.intersphinx import inspect_main

if len(sys.argv) < 2:
sys.exit("Usage: python -m intersphinx_registry.lookup [packages...]")

packages = sys.argv[1:]

urls = [
u[0] + (u[1] if u[1] else "objects.inv")
for u in get_intersphinx_mapping(packages=packages).values()
]


import logging as _logging

_logging.basicConfig()
raise SystemExit(inspect_main(urls))

0 comments on commit 1fa733e

Please sign in to comment.