Skip to content

Commit f28d5ef

Browse files
committed
refactor: make Cyclopts applications return an exit code
1 parent bbd2938 commit f28d5ef

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

changelog.d/+7571c495.changed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Make Cyclopts applications return an exit code.

template/src/{{ package_name }}/{% if cli == 'cyclopts' %}.{% endif %}/cli.py.jinja

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@ import cyclopts
66

77
from . import __version__
88

9-
app = cyclopts.App(
10-
help="Run the main program.",
11-
version=f"{{ distribution_name }}, version {__version__}",
12-
)
9+
app = cyclopts.App(version=f"{{ distribution_name }}, version {__version__}")
1310

1411

1512
@app.default
16-
def main() -> None:
17-
"""Run the main program."""
18-
return
13+
def main() -> int:
14+
"""Run the main program.
15+
16+
Returns:
17+
An exit code.
18+
"""
19+
return 0
1920

2021

2122
if __name__ == "__main__":

0 commit comments

Comments
 (0)