Coverage for src/workstack/cli/commands/shell_integration.py: 100%

12 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2025-10-19 09:31 -0400

1import click 

2 

3from workstack.cli.shell_integration.handler import ( 

4 PASSTHROUGH_MARKER, 

5 ShellIntegrationResult, 

6 handle_shell_request, 

7) 

8 

9 

10@click.command( 

11 "__shell", 

12 hidden=True, 

13 add_help_option=False, 

14 context_settings={"ignore_unknown_options": True, "allow_interspersed_args": False}, 

15) 

16@click.argument("args", nargs=-1, type=click.UNPROCESSED) 

17def hidden_shell_cmd(args: tuple[str, ...]) -> None: 

18 """Unified entry point for shell integration wrappers.""" 

19 result: ShellIntegrationResult = handle_shell_request(args) 

20 

21 if result.passthrough: 

22 click.echo(PASSTHROUGH_MARKER) 

23 raise SystemExit(result.exit_code) 

24 

25 if result.script: 

26 click.echo(result.script, nl=False) 

27 

28 raise SystemExit(result.exit_code)