Skip to content

Commit

Permalink
chore: examples cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
angrybayblade committed Oct 30, 2023
1 parent 86197a7 commit 15a060b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion clea/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

from .context import Context # noqa: F401
from .exceptions import CleaException # noqa: F401
from .params import ( # noqa: F401
Boolean,
Choice,
Expand All @@ -18,4 +19,3 @@
)
from .runner import run # noqa: F401
from .wrappers import command, group # noqa: F401
from .exceptions import CleaException # noqa: F401
4 changes: 1 addition & 3 deletions examples/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

from typing_extensions import Annotated

from clea.params import Integer
from clea.runner import run
from clea.wrappers import command
from clea import Integer, command, run


@command
Expand Down
19 changes: 19 additions & 0 deletions examples/add_numbers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""Simple add program with custom command name."""

from typing_extensions import Annotated

from clea import Integer, command, run


@command(name="add-numbers")
def add(
n1: Annotated[int, Integer()],
n2: Annotated[int, Integer()],
) -> None:
"""Add two numbers"""

print(f"Total {n1 + n2}")


if __name__ == "__main__": # pragma: nocover
run(cli=add)
4 changes: 1 addition & 3 deletions examples/calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@

from typing_extensions import Annotated

from clea.params import Boolean, Integer
from clea.runner import run
from clea.wrappers import group
from clea import Boolean, Integer, group, run


@group
Expand Down

0 comments on commit 15a060b

Please sign in to comment.