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.
- {ask_shell-0.5.2 → ask_shell-0.5.3}/PKG-INFO +1 -1
- {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/__init__.py +1 -1
- {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/_internal/typer_command.py +45 -12
- {ask_shell-0.5.2 → ask_shell-0.5.3}/pyproject.toml +1 -1
- {ask_shell-0.5.2 → ask_shell-0.5.3}/.gitignore +0 -0
- {ask_shell-0.5.2 → ask_shell-0.5.3}/LICENSE +0 -0
- {ask_shell-0.5.2 → ask_shell-0.5.3}/README.md +0 -0
- {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/__main__.py +0 -0
- {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/_internal/__init__.py +0 -0
- {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/_internal/_run.py +0 -0
- {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/_internal/_run_env.py +0 -0
- {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/_internal/events.py +0 -0
- {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/_internal/global_callbacks.py +0 -0
- {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/_internal/interactive.py +0 -0
- {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/_internal/models.py +0 -0
- {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/_internal/rich_live.py +0 -0
- {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/_internal/rich_live_callback.py +0 -0
- {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/_internal/rich_progress.py +0 -0
- {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/_internal/rich_run_state.py +0 -0
- {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/_internal/run_pool.py +0 -0
- {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/ask.py +0 -0
- {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/console.py +0 -0
- {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/py.typed +0 -0
- {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/settings.py +0 -0
- {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/shell.py +0 -0
- {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/shell_events.py +0 -0
- {ask_shell-0.5.2 → ask_shell-0.5.3}/ask_shell/test_docs.py +0 -0
- {ask_shell-0.5.2 → ask_shell-0.5.3}/scripts/fix_source_links.py +0 -0
|
@@ -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
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
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,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|