Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/git_draft/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def edit(*, path: Path | None = None, text: str | None = None) -> str:
_PROMPT_PLACEHOLDER = "Enter your prompt here..."


async def main() -> None: # noqa: PLR0912 PLR0915
async def run() -> None: # noqa: PLR0912 PLR0915
config = Config.load()
(opts, args) = new_parser().parse_args()

Expand Down Expand Up @@ -230,10 +230,14 @@ async def main() -> None: # noqa: PLR0912 PLR0915
raise UnreachableError()


if __name__ == "__main__":
def main() -> None:
try:
asyncio.run(main())
asyncio.run(run())
except Exception as err:
_logger.exception("Program failed.")
print(f"Error: {err}", file=sys.stderr)
sys.exit(1)


if __name__ == "__main__":
main()