(typer_instance: Typer)
| 1171 | |
| 1172 | |
| 1173 | def get_command(typer_instance: Typer) -> _click.Command: |
| 1174 | if typer_instance._add_completion: |
| 1175 | click_install_param, click_show_param = get_install_completion_arguments() |
| 1176 | if ( |
| 1177 | typer_instance.registered_callback |
| 1178 | or typer_instance.info.callback |
| 1179 | or typer_instance.registered_groups |
| 1180 | or len(typer_instance.registered_commands) > 1 |
| 1181 | ): |
| 1182 | # Create a Group |
| 1183 | click_command: _click.Command = get_group(typer_instance) |
| 1184 | if typer_instance._add_completion: |
| 1185 | click_command.params.append(click_install_param) |
| 1186 | click_command.params.append(click_show_param) |
| 1187 | return click_command |
| 1188 | elif len(typer_instance.registered_commands) == 1: |
| 1189 | # Create a single Command |
| 1190 | single_command = typer_instance.registered_commands[0] |
| 1191 | |
| 1192 | if not single_command.context_settings and not isinstance( |
| 1193 | typer_instance.info.context_settings, DefaultPlaceholder |
| 1194 | ): |
| 1195 | single_command.context_settings = typer_instance.info.context_settings |
| 1196 | |
| 1197 | click_command = get_command_from_info( |
| 1198 | single_command, |
| 1199 | pretty_exceptions_short=typer_instance.pretty_exceptions_short, |
| 1200 | rich_markup_mode=typer_instance.rich_markup_mode, |
| 1201 | ) |
| 1202 | if typer_instance._add_completion: |
| 1203 | click_command.params.append(click_install_param) |
| 1204 | click_command.params.append(click_show_param) |
| 1205 | return click_command |
| 1206 | raise RuntimeError( |
| 1207 | "Could not get a command for this Typer instance" |
| 1208 | ) # pragma: no cover |
| 1209 | |
| 1210 | |
| 1211 | def solve_typer_info_help(typer_info: TyperInfo) -> str: |
no test coverage detected
searching dependent graphs…