#!/usr/bin/env python3
"""Wizard Kit: Mount all volumes"""
# vim: sts=2 sw=2 ts=2

import sys

import wk


# Functions
def main():
  """Mount all volumes and show results."""
  wk.std.print_standard(f'{wk.cfg.main.KIT_NAME_FULL}: Volume mount tool')
  wk.std.print_standard(' ')

  # Mount volumes and get report
  wk.std.print_standard('Mounting volumes...')
  report = wk.os.linux.mount_volumes()

  # Show results
  wk.std.print_info('Results')
  wk.std.print_report(report, indent=2)

  # GUI mode
  if 'gui' in sys.argv:
    wk.std.pause('Press Enter to exit...')
    wk.exe.popen_program(['nohup', 'thunar', '/media'])


if __name__ == '__main__':
  if wk.std.PLATFORM != 'Linux':
    os_name = wk.std.PLATFORM.replace('Darwin', 'macOS')
    wk.std.print_error(f'This script is not supported under {os_name}.')
    wk.std.abort()
  try:
    main()
  except SystemExit:
    raise
  except: #pylint: disable=bare-except
    wk.std.major_exception()
