INNER CODE UNIT · Python
_ls
pybel/pybel · src/pybel/cli.py:460
def _ls(manager: Manager, model_cls, model_id: int):
if model_id:
n = manager.session.query(model_cls).get(model_id)
_page(n.entries)
else:
for n in manager.session.query(model_cls).order_by(model_cls.uploaded.desc()):
click.echo("\t".join(map(str, (n.id, n.keyword, n.version, n.url))))
@namespaces.command()
@click.option("-u", "--url", help="Specific resource URL to list")
@click.option("-i", "--namespace-id", type=int, help="Specific resource URL to list")
@click.pass_obj
def ls(manager: Manager, url: str | None, namespace_id: int | None):
"""List cached namespaces."""
if url:
n = manager.get_or_create_namespace(url)