lib-cli-exit-tools 2.3.3__py3-none-any.whl → 2.3.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,7 +26,7 @@ name = "lib_cli_exit_tools"
26
26
  #: Human-readable summary shown in CLI help output.
27
27
  title = "CLI exit handling helpers: clean signals, exit codes, and error printing"
28
28
  #: Current release version pulled from ``pyproject.toml`` by automation.
29
- version = "2.3.3"
29
+ version = "2.3.4"
30
30
  #: Repository homepage presented to users.
31
31
  homepage = "https://github.com/bitranox/lib_cli_exit_tools"
32
32
  #: Author attribution surfaced in CLI output.
@@ -60,7 +60,9 @@ class ClickCommand(Protocol):
60
60
  complete_var: str | None = ...,
61
61
  standalone_mode: bool = ..., # noqa: FBT001 - mirrors Click's actual positional main() signature
62
62
  **_: object,
63
- ) -> None: ...
63
+ ) -> object:
64
+ """Return Click's own result: ctx.exit()'s code, or None on success."""
65
+ ...
64
66
 
65
67
 
66
68
  __all__ = [
@@ -681,10 +683,15 @@ def _run_command_with_handler(
681
683
  ) -> int:
682
684
  """Invoke the Click command and delegate failures to ``handler``."""
683
685
  try:
684
- _invoke_command(cli, argv, prog_name)
686
+ outcome = _invoke_command(cli, argv, prog_name)
685
687
  except BaseException as exc: # single funnel for exit codes; handler translates every exception type
686
688
  return handler(exc)
687
- return 0
689
+ # Click is invoked with standalone_mode=False, which makes it *return*
690
+ # ctx.exit()'s code rather than raising it. That is how a command reports a
691
+ # negative answer - nothing found, host did not respond - as distinct from
692
+ # an error. Discarding this value would collapse every such outcome to
693
+ # success; None is Click's plain-success result and stays 0.
694
+ return outcome if isinstance(outcome, int) else 0
688
695
 
689
696
 
690
697
  def _finalise_cli_run(restorer: Callable[[], None] | None) -> None:
@@ -693,9 +700,15 @@ def _finalise_cli_run(restorer: Callable[[], None] | None) -> None:
693
700
  flush_streams()
694
701
 
695
702
 
696
- def _invoke_command(cli: ClickCommand, argv: Sequence[str] | None, prog_name: str | None) -> None:
697
- """Invoke the Click command with ``standalone_mode`` disabled."""
698
- cli.main(args=_normalised_args(argv), standalone_mode=False, prog_name=prog_name)
703
+ def _invoke_command(cli: ClickCommand, argv: Sequence[str] | None, prog_name: str | None) -> object:
704
+ """Invoke the Click command with ``standalone_mode`` disabled.
705
+
706
+ Returns:
707
+ Whatever Click returns: the code passed to ``ctx.exit()``, or ``None``
708
+ when the command simply completed.
709
+ """
710
+
711
+ return cli.main(args=_normalised_args(argv), standalone_mode=False, prog_name=prog_name)
699
712
 
700
713
 
701
714
  def _normalised_args(argv: Sequence[str] | None) -> Sequence[str] | None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lib_cli_exit_tools
3
- Version: 2.3.3
3
+ Version: 2.3.4
4
4
  Summary: CLI exit handling helpers: clean signals, exit codes, and error printing
5
5
  Project-URL: Homepage, https://github.com/bitranox/lib_cli_exit_tools
6
6
  Project-URL: Repository, https://github.com/bitranox/lib_cli_exit_tools.git
@@ -27,7 +27,7 @@ Requires-Dist: bandit>=1.9.4; extra == 'dev'
27
27
  Requires-Dist: build>=1.5.0; extra == 'dev'
28
28
  Requires-Dist: click>=8.4.2; extra == 'dev'
29
29
  Requires-Dist: coverage[toml]>=7.15.2; extra == 'dev'
30
- Requires-Dist: hypothesis>=6.161.2; extra == 'dev'
30
+ Requires-Dist: hypothesis>=6.163.0; extra == 'dev'
31
31
  Requires-Dist: import-linter>=2.13; extra == 'dev'
32
32
  Requires-Dist: pip-audit>=2.10.1; extra == 'dev'
33
33
  Requires-Dist: pyright[nodejs]>=1.1.411; extra == 'dev'
@@ -37,7 +37,7 @@ Requires-Dist: pytest>=9.1.1; extra == 'dev'
37
37
  Requires-Dist: rtoml>=0.13.0; extra == 'dev'
38
38
  Requires-Dist: ruff>=0.16.0; extra == 'dev'
39
39
  Requires-Dist: textual>=8.2.8; extra == 'dev'
40
- Requires-Dist: twine>=6.2.0; extra == 'dev'
40
+ Requires-Dist: twine>=7.0.0; extra == 'dev'
41
41
  Description-Content-Type: text/markdown
42
42
 
43
43
  # lib_cli_exit_tools
@@ -1,12 +1,12 @@
1
1
  lib_cli_exit_tools/__init__.py,sha256=KzpZAMrc328V_nYm2GuTR0Sxyqh0XuKtlHP6dVCs2pc,1905
2
- lib_cli_exit_tools/__init__conf__.py,sha256=b534uXj2ERNqtNu5PlbbK1lFwd867h0cmF_919XXOkw,2551
2
+ lib_cli_exit_tools/__init__conf__.py,sha256=G8Wfni4rgKyD0DwTW3NkaezV8ADKWZSl8oI78ehNbbM,2551
3
3
  lib_cli_exit_tools/__main__.py,sha256=wODJaNu_NyO7tknvlpPArq0MaDwDum8zqyb73-qshzo,257
4
4
  lib_cli_exit_tools/lib_cli_exit_tools.py,sha256=QIKdg_Z1_RkJe5FGaM4-bTHDcX4NTo_ecrSMG6dZyIY,2561
5
5
  lib_cli_exit_tools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  lib_cli_exit_tools/adapters/__init__.py,sha256=Jj8FCGY1lAPAduYSW3wTDh8ojpr9BZms7wKEMPq8pWE,504
7
7
  lib_cli_exit_tools/adapters/signals.py,sha256=vRgKr3cozB5WJGel1meACJ24OYhACUM1YCyRAqI2S8U,6125
8
8
  lib_cli_exit_tools/application/__init__.py,sha256=Yikej3OOOaAjWOvFimg1jUYrCUGu5d3-RBiiai4tHDM,566
9
- lib_cli_exit_tools/application/runner.py,sha256=15QA5rqZc-Tplljv_bENxvwN4nQzxPCE1Hepm4twom8,24667
9
+ lib_cli_exit_tools/application/runner.py,sha256=vPMibF5pvuBA1vTrWr8wyjk5MKvDcFhxrTbwCXSgnpQ,25333
10
10
  lib_cli_exit_tools/cli/__init__.py,sha256=IVyU1DEgn2xBYfp1BBpund9nucUEPyOu7yt8DShu470,1094
11
11
  lib_cli_exit_tools/cli/commands.py,sha256=5eDpFhFMUN1hIJLSdQcWp28iGtAxXPfchP8cwNNRFQE,2404
12
12
  lib_cli_exit_tools/cli/group.py,sha256=Ic5nAMewWVeTCtbri6WWa2C1YWIi5ewlRGIFkTGED8Y,4302
@@ -15,8 +15,8 @@ lib_cli_exit_tools/cli/typed_click.py,sha256=VLZgUkCZ6AFnf6StvoztK3JVYj9lZmgPSNY
15
15
  lib_cli_exit_tools/core/__init__.py,sha256=aR7OIBWOQ1PsA33blOTgLrq5ffKDCuaMVBS5mbrDAZ8,531
16
16
  lib_cli_exit_tools/core/configuration.py,sha256=XWM4KYAAhlTZgF71z7JQDOfm7IshezzPZt6z043WQuU,6153
17
17
  lib_cli_exit_tools/core/exit_codes.py,sha256=dlwvjsfMFrbEfWJVjYznmQfAa-JAHVrtY7FGPSMxppo,12449
18
- lib_cli_exit_tools-2.3.3.dist-info/METADATA,sha256=CnxLc0V9HAs9J4CiKkRMm5gNjMAqC7t4xou5nnjq4k4,26310
19
- lib_cli_exit_tools-2.3.3.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
20
- lib_cli_exit_tools-2.3.3.dist-info/entry_points.txt,sha256=8R-_3UT0KcQ7HQ7idDx6rlG77GhHb0E2N5QnN41dj-M,161
21
- lib_cli_exit_tools-2.3.3.dist-info/licenses/LICENSE,sha256=6s9SL2InRrwynPjJYiER7ONHBshbGj_yC5EBzfo7l9I,1072
22
- lib_cli_exit_tools-2.3.3.dist-info/RECORD,,
18
+ lib_cli_exit_tools-2.3.4.dist-info/METADATA,sha256=jnGFlt6aff1a0ogGme_X3etEd7aZiWGy460RFymGAqc,26310
19
+ lib_cli_exit_tools-2.3.4.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
20
+ lib_cli_exit_tools-2.3.4.dist-info/entry_points.txt,sha256=8R-_3UT0KcQ7HQ7idDx6rlG77GhHb0E2N5QnN41dj-M,161
21
+ lib_cli_exit_tools-2.3.4.dist-info/licenses/LICENSE,sha256=6s9SL2InRrwynPjJYiER7ONHBshbGj_yC5EBzfo7l9I,1072
22
+ lib_cli_exit_tools-2.3.4.dist-info/RECORD,,