MCPcopy Index your code
hub / github.com/archlinux/archinstall / _share_log_command

Function _share_log_command

archinstall/main.py:78–107  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

76
77
78def _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
110def run() -> int:

Callers 1

runFunction · 0.85

Calls 10

trFunction · 0.90
share_install_logFunction · 0.90
infoFunction · 0.90
errorFunction · 0.90
get_contentMethod · 0.80
formatMethod · 0.80
yes_noMethod · 0.80
set_preview_for_allMethod · 0.80
decodeMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected