ask-shell 0.5.2__tar.gz → 0.5.3__tar.gz

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.
Files changed (28) hide show
  1. {ask_shell-0.5.2 → ask_shell-0.5.3}/PKG-INFO +1 -1
  2. {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/__init__.py +1 -1
  3. {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/_internal/typer_command.py +45 -12
  4. {ask_shell-0.5.2 → ask_shell-0.5.3}/pyproject.toml +1 -1
  5. {ask_shell-0.5.2 → ask_shell-0.5.3}/.gitignore +0 -0
  6. {ask_shell-0.5.2 → ask_shell-0.5.3}/LICENSE +0 -0
  7. {ask_shell-0.5.2 → ask_shell-0.5.3}/README.md +0 -0
  8. {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/__main__.py +0 -0
  9. {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/_internal/__init__.py +0 -0
  10. {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/_internal/_run.py +0 -0
  11. {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/_internal/_run_env.py +0 -0
  12. {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/_internal/events.py +0 -0
  13. {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/_internal/global_callbacks.py +0 -0
  14. {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/_internal/interactive.py +0 -0
  15. {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/_internal/models.py +0 -0
  16. {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/_internal/rich_live.py +0 -0
  17. {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/_internal/rich_live_callback.py +0 -0
  18. {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/_internal/rich_progress.py +0 -0
  19. {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/_internal/rich_run_state.py +0 -0
  20. {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/_internal/run_pool.py +0 -0
  21. {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/ask.py +0 -0
  22. {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/console.py +0 -0
  23. {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/py.typed +0 -0
  24. {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/settings.py +0 -0
  25. {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/shell.py +0 -0
  26. {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/shell_events.py +0 -0
  27. {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/test_docs.py +0 -0
  28. {ask_shell-0.5.2 → ask_shell-0.5.3}/scripts/fix_source_links.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ask-shell
3
- Version: 0.5.2
3
+ Version: 0.5.3
4
4
  Summary: CLIs with prompts, shell runs, and testable flows
5
5
  Author-email: EspenAlbert <espen.albert1@gmail.com>
6
6
  License-Expression: MIT
@@ -6,7 +6,7 @@ from ask_shell import shell_events
6
6
  from ask_shell import ask
7
7
  from ask_shell.settings import AskShellSettings
8
8
 
9
- VERSION = "0.5.2"
9
+ VERSION = "0.5.3"
10
10
  __all__ = [
11
11
  "shell",
12
12
  "console",
@@ -88,6 +88,42 @@ def track_progress_decorator(
88
88
  return decorator
89
89
 
90
90
 
91
+ def _wrap_typer_tree_commands(
92
+ app: typer.Typer,
93
+ *,
94
+ settings: AskShellSettings,
95
+ log_path_prefix: str,
96
+ skip_except_hook: bool,
97
+ use_app_name_command_for_logs: bool,
98
+ render_rich_error_on_sys_exit: bool,
99
+ ) -> None:
100
+ for command in app.registered_commands:
101
+ command.callback = track_progress_decorator(
102
+ skip_except_hook=skip_except_hook,
103
+ settings=settings,
104
+ use_app_name_command_for_logs=use_app_name_command_for_logs,
105
+ app_name=log_path_prefix,
106
+ command_name=command.name or command.callback.__name__, # type: ignore
107
+ skip_rich_exception=not render_rich_error_on_sys_exit,
108
+ )(
109
+ command.callback # type: ignore
110
+ )
111
+ for group in app.registered_groups:
112
+ nested = group.typer_instance
113
+ if nested is None:
114
+ continue
115
+ segment = group.name or nested.info.name or "group"
116
+ child_prefix = f"{log_path_prefix}/{segment}"
117
+ _wrap_typer_tree_commands(
118
+ nested,
119
+ settings=settings,
120
+ log_path_prefix=child_prefix,
121
+ skip_except_hook=skip_except_hook,
122
+ use_app_name_command_for_logs=use_app_name_command_for_logs,
123
+ render_rich_error_on_sys_exit=render_rich_error_on_sys_exit,
124
+ )
125
+
126
+
91
127
  def remove_secrets(message: str, secrets: list[str]) -> str:
92
128
  for secret in secrets:
93
129
  message = message.replace(secret, "***")
@@ -141,18 +177,15 @@ def configure_logging(
141
177
  render_rich_error_on_sys_exit: bool = False,
142
178
  ) -> logging.Handler:
143
179
  settings = settings or AskShellSettings.from_env()
144
- app_name = app.info.name or "typer_app"
145
- for command in app.registered_commands:
146
- command.callback = track_progress_decorator(
147
- skip_except_hook=skip_except_hook,
148
- settings=settings,
149
- use_app_name_command_for_logs=use_app_name_command_for_logs,
150
- app_name=app_name,
151
- command_name=command.name or command.callback.__name__, # type: ignore
152
- skip_rich_exception=not render_rich_error_on_sys_exit,
153
- )(
154
- command.callback # type: ignore
155
- )
180
+ root_prefix = app.info.name or "typer_app"
181
+ _wrap_typer_tree_commands(
182
+ app,
183
+ settings=settings,
184
+ log_path_prefix=root_prefix,
185
+ skip_except_hook=skip_except_hook,
186
+ use_app_name_command_for_logs=use_app_name_command_for_logs,
187
+ render_rich_error_on_sys_exit=render_rich_error_on_sys_exit,
188
+ )
156
189
  handler = RichHandler(rich_tracebacks=False, level=settings.log_level, console=get_live_console())
157
190
  logging.basicConfig(
158
191
  level=settings.log_level,
@@ -2,7 +2,7 @@
2
2
 
3
3
  [project]
4
4
  name = "ask-shell"
5
- version = "0.5.2"
5
+ version = "0.5.3"
6
6
  description = "CLIs with prompts, shell runs, and testable flows"
7
7
  requires-python = ">=3.13"
8
8
  license = "MIT"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes