Skip to content

Commit d1e4f66

Browse files
committed
doc: command docstrings can be in Sphinx format
And thanks to sphinx-click-rst-to-ansi-formatter this will display correctly in the terminal. https://github.com/hakonhagland/sphinx-click-rst-to-ansi-formatter
1 parent 8335de3 commit d1e4f66

4 files changed

Lines changed: 32 additions & 50 deletions

File tree

.github/workflows/tests.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ jobs:
2121
- '3.12'
2222
- '3.11'
2323
- '3.10'
24-
- '3.9'
2524
steps:
2625
- uses: actions/checkout@v4
2726
- name: Install Poetry
@@ -45,7 +44,7 @@ jobs:
4544
uses: snok/install-poetry@v1
4645
- uses: actions/setup-python@v5
4746
with:
48-
python-version: '3.9'
47+
python-version: '3.10'
4948
cache: 'poetry'
5049
- run: sed -i -E 's/"(\^|>=)([0-9\.]+)([^,]*)"/"==\2"/' pyproject.toml
5150
- run: sed -i -E 's/python = "==/python = "^/' pyproject.toml

poetry.lock

Lines changed: 22 additions & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ classifiers = [
2525
]
2626

2727
[tool.poetry.dependencies]
28-
python = "^3.9"
28+
python = "^3.10"
2929
click = "^8.1.7"
3030
requests = "^2.32.2"
31+
sphinx-click-rst-to-ansi-formatter = "^0.1.0"
3132

3233
[tool.poetry.group.dev.dependencies]
3334
pytest = "^8.2.1"
@@ -84,7 +85,6 @@ isolated_build = true
8485
skipsdist = true
8586
envlist =
8687
style
87-
py39
8888
py310
8989
py311
9090
py312

scim_cli/__init__.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
import click
44
import requests
5+
from sphinx_click.rst_to_ansi_formatter import make_rst_to_ansi_formatter
56

7+
DOC_URL = "https://scim-cli.readthedocs.io/"
68
BASE_HEADERS = {
79
"Accept": "application/scim+json",
810
"Content-Type": "application/scim+json",
@@ -22,7 +24,7 @@ def cli(ctx, url):
2224
ctx.obj["STDIN"] = json.loads(stdin)
2325

2426

25-
@cli.command()
27+
@cli.command(cls=make_rst_to_ansi_formatter(DOC_URL))
2628
@click.pass_context
2729
def get(ctx):
2830
"""Perform a SCIM GET request.
@@ -43,7 +45,7 @@ def get(ctx):
4345
click.echo(response.text)
4446

4547

46-
@cli.command()
48+
@cli.command(cls=make_rst_to_ansi_formatter(DOC_URL))
4749
@click.pass_context
4850
def post(ctx):
4951
"""Perform a SCIM POST request.
@@ -64,7 +66,7 @@ def post(ctx):
6466
click.echo(response.text)
6567

6668

67-
@cli.command()
69+
@cli.command(cls=make_rst_to_ansi_formatter(DOC_URL))
6870
@click.pass_context
6971
def put(ctx):
7072
"""Perform a SCIM PUT request.
@@ -85,7 +87,7 @@ def put(ctx):
8587
click.echo(response.text)
8688

8789

88-
@cli.command()
90+
@cli.command(cls=make_rst_to_ansi_formatter(DOC_URL))
8991
@click.pass_context
9092
def patch(ctx):
9193
"""Perform a SCIM PATCH request.
@@ -106,7 +108,7 @@ def patch(ctx):
106108
click.echo(response.text)
107109

108110

109-
@cli.command()
111+
@cli.command(cls=make_rst_to_ansi_formatter(DOC_URL))
110112
@click.pass_context
111113
def delete(ctx):
112114
"""Perform a SCIM DELETE request.

0 commit comments

Comments
 (0)