Skip to content

Commit

Permalink
update CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
rprimet committed Feb 16, 2024
1 parent 0ba7aee commit 8800670
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/catleg/catleg.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
app.add_typer(lf, name="lf", help="Commands for querying the raw Legifrance API")


def _article(aid_or_url: str):
def _article(aid_or_url: str, breadcrumbs: bool):
article_id = article_id_or_url(aid_or_url)
if article_id is None:
raise ValueError(f"Sorry, I do not know how to process {aid_or_url}")

skel = asyncio.run(askel(article_id))
skel = asyncio.run(askel(article_id, breadcrumbs=breadcrumbs))
return skel


Expand All @@ -35,14 +35,20 @@ def article(
help="An article ID or Legifrance URL, for instance 'LEGIARTI000033971416' "
"or 'https://www.legifrance.gouv.fr/codes/article_lc/LEGIARTI000033971416'."
),
]
],
nb: Annotated[
bool,
typer.Option(
help="If specified, do not print breadcrumbs (table of contents headers)"
),
] = False,
):
"""
Output an article.
By default, outputs markdown-formatted text.
"""

print(_article(aid_or_url))
print(_article(aid_or_url, not nb))


@app.command()
Expand Down

0 comments on commit 8800670

Please sign in to comment.