mahmoud / mahmoud/face

sys.exit(0) alternative for helpers.py HelpHandler.default_help_func

Open
#2 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
24
Forks
12
PR merge metrics
No merged PRs in 30d

Description

## What
Alternative to calling `sys.exit()` inside of `HelpHandler.default_help_func` method.

## Why
It makes writing tests trickier. Any tests that run that method will fail. Ways of dealing with this feel like hacks.

Experience messing around with it in the shell is less than ideal. ipython does not exit, just throws error, but it is a little annoying.

## Alternative
Throw an `HelpExitException` in place of `sys.exit(0)` in `HelpHandler.default_help_func`. Then catch `HelpExitException` at the top level of the program. Call `sys.exit(0)` in the `except` block. Or just allow the program to exit naturally.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review helpers.py and the HelpHandler.default_help_func method first, then trace how the CLI reaches the top-level program handling. The work is complete when help handling no longer calls sys.exit() inside the helper and the command still terminates appropriately while remaining easier to test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.