()
| 76 | |
| 77 | |
| 78 | def _share_log_command() -> None: |
| 79 | paste_url: str = 'https://paste.rs' |
| 80 | log_path = logger.path |
| 81 | max_size = 10 * 1024 * 1024 # max supported size by paste.rs |
| 82 | content = logger.get_content(max_bytes=max_size).decode() |
| 83 | |
| 84 | header = tr('About to upload "{}" to the publicly accessible {}').format(log_path, paste_url) + '\n\n' |
| 85 | header += tr('Do you want to continue?') |
| 86 | |
| 87 | group = MenuItemGroup.yes_no() |
| 88 | group.set_preview_for_all(lambda _: content) |
| 89 | |
| 90 | async def _confirm() -> bool: |
| 91 | result = await Confirmation( |
| 92 | header=header, |
| 93 | allow_skip=False, |
| 94 | group=group, |
| 95 | preview_header='Log content', |
| 96 | preview_location='bottom', |
| 97 | ).show() |
| 98 | return result.get_value() |
| 99 | |
| 100 | result = tui.run(_confirm) |
| 101 | |
| 102 | if result is True: |
| 103 | res = share_install_log(paste_url=paste_url, max_bytes=max_size) |
| 104 | if res is not None: |
| 105 | info(tr('Log uploaded successfully. URL: {}').format(res)) |
| 106 | else: |
| 107 | error(tr('Failed to upload log.')) |
| 108 | |
| 109 | |
| 110 | def run() -> int: |
no test coverage detected