mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-05 00:15:32 +00:00
This change allows to collect data for a diagnostic report. This can be done either from the command line through the new `km-diag-report` tool, or in `km-config` from the new `Support` tab that allows to generate the report and then copy it to the clipboard or save as a file. The diagnostic report contains installed browsers and their versions and installation methods as well as the default browser. It checks for browsers installed through apt (Ubuntu/Debian), snap, and flatpak. The change also has an implementation for pacman (Arch Linux) and dnf/yum (Fedora), although these have not been tested. Fixes: #7784
39 lines
1.1 KiB
Python
Executable file
39 lines
1.1 KiB
Python
Executable file
#!/usr/bin/python3
|
|
|
|
import argparse
|
|
import sys
|
|
|
|
from keyman_config import add_standard_arguments, initialize_logging, initialize_sentry
|
|
from keyman_config.diag_report import get_diagnostic_report
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(
|
|
description='Generate a diagnostic report of Keyman and system configuration. '
|
|
'This report can be used for troubleshooting Keyman issues.')
|
|
parser.add_argument('-o', '--output', metavar='FILE',
|
|
help='write report to FILE instead of stdout')
|
|
add_standard_arguments(parser)
|
|
|
|
args = parser.parse_args()
|
|
|
|
initialize_logging(args)
|
|
initialize_sentry()
|
|
|
|
report = get_diagnostic_report()
|
|
|
|
if args.output:
|
|
try:
|
|
with open(args.output, 'w', encoding='utf-8') as f:
|
|
f.write(report)
|
|
f.write('\n')
|
|
print(f"Diagnostic report written to {args.output}")
|
|
except IOError as e:
|
|
print(f"Error writing to file: {e}", file=sys.stderr)
|
|
sys.exit(1)
|
|
else:
|
|
print(report)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|