[cli] Set default platform to Mac when running on macOS

This commit is contained in:
derrod 2021-12-02 15:23:16 +01:00
parent aeecaa4d3e
commit 4eaa608370

View file

@ -16,7 +16,7 @@ from distutils.util import strtobool
from logging.handlers import QueueListener from logging.handlers import QueueListener
from multiprocessing import freeze_support, Queue as MPQueue from multiprocessing import freeze_support, Queue as MPQueue
from platform import platform from platform import platform
from sys import exit, stdout from sys import exit, stdout, platform as sys_platform
from legendary import __version__, __codename__ from legendary import __version__, __codename__
from legendary.core import LegendaryCore from legendary.core import LegendaryCore
@ -1830,8 +1830,9 @@ def main():
help='Only update, do not do anything if specified app is not installed') help='Only update, do not do anything if specified app is not installed')
install_parser.add_argument('--dlm-debug', dest='dlm_debug', action='store_true', install_parser.add_argument('--dlm-debug', dest='dlm_debug', action='store_true',
help='Set download manager and worker processes\' loglevel to debug') help='Set download manager and worker processes\' loglevel to debug')
install_parser.add_argument('--platform', dest='platform', action='store', metavar='<Platform>', default='Windows', install_parser.add_argument('--platform', dest='platform', action='store', metavar='<Platform>',
type=str, help='Platform for install (default: installed or Windows)') default='Mac' if sys_platform == 'darwin' else 'Windows', type=str,
help='Platform for install (default: installed or Windows)')
install_parser.add_argument('--prefix', dest='file_prefix', action='append', metavar='<prefix>', install_parser.add_argument('--prefix', dest='file_prefix', action='append', metavar='<prefix>',
help='Only fetch files whose path starts with <prefix> (case insensitive)') help='Only fetch files whose path starts with <prefix> (case insensitive)')
install_parser.add_argument('--exclude', dest='file_exclude_prefix', action='append', metavar='<prefix>', install_parser.add_argument('--exclude', dest='file_exclude_prefix', action='append', metavar='<prefix>',
@ -1912,8 +1913,9 @@ def main():
launch_parser.add_argument('--no-wine', dest='no_wine', help=argparse.SUPPRESS, launch_parser.add_argument('--no-wine', dest='no_wine', help=argparse.SUPPRESS,
action='store_true', default=True) action='store_true', default=True)
list_parser.add_argument('--platform', dest='platform', action='store', metavar='<Platform>', default='Windows', list_parser.add_argument('--platform', dest='platform', action='store', metavar='<Platform>',
type=str, help='Override platform that games are shown for (e.g. Win32/Mac)') default='Mac' if sys_platform == 'darwin' else 'Windows', type=str,
help='Platform to fetch game list for (default: Mac on macOS, otherwise Windows)')
list_parser.add_argument('--include-ue', dest='include_ue', action='store_true', list_parser.add_argument('--include-ue', dest='include_ue', action='store_true',
help='Also include Unreal Engine content (Engine/Marketplace) in list') help='Also include Unreal Engine content (Engine/Marketplace) in list')
list_parser.add_argument('--include-non-installable', dest='include_noasset', action='store_true', list_parser.add_argument('--include-non-installable', dest='include_noasset', action='store_true',
@ -1938,7 +1940,8 @@ def main():
list_files_parser.add_argument('--force-download', dest='force_download', action='store_true', list_files_parser.add_argument('--force-download', dest='force_download', action='store_true',
help='Always download instead of using on-disk manifest') help='Always download instead of using on-disk manifest')
list_files_parser.add_argument('--platform', dest='platform', action='store', metavar='<Platform>', list_files_parser.add_argument('--platform', dest='platform', action='store', metavar='<Platform>',
type=str, help='Platform (default: Windows)', default='Windows') type=str, help='Platform (default: Mac on macOS, otherwise Windows)',
default='Mac' if sys_platform == 'darwin' else 'Windows')
list_files_parser.add_argument('--manifest', dest='override_manifest', action='store', metavar='<uri>', list_files_parser.add_argument('--manifest', dest='override_manifest', action='store', metavar='<uri>',
help='Manifest URL or path to use instead of the CDN one') help='Manifest URL or path to use instead of the CDN one')
list_files_parser.add_argument('--csv', dest='csv', action='store_true', help='Output in CSV format') list_files_parser.add_argument('--csv', dest='csv', action='store_true', help='Output in CSV format')
@ -1973,7 +1976,8 @@ def main():
import_parser.add_argument('--skip-dlcs', dest='skip_dlcs', action='store_true', import_parser.add_argument('--skip-dlcs', dest='skip_dlcs', action='store_true',
help='Do not ask about importing DLCs.') help='Do not ask about importing DLCs.')
import_parser.add_argument('--platform', dest='platform', action='store', metavar='<Platform>', import_parser.add_argument('--platform', dest='platform', action='store', metavar='<Platform>',
type=str, help='Platform override for import', default='Windows') type=str, help='Platform for import (default: Mac on macOS, otherwise Windows)',
default='Mac' if sys_platform == 'darwin' else 'Windows')
egl_sync_parser.add_argument('--egl-manifest-path', dest='egl_manifest_path', action='store', egl_sync_parser.add_argument('--egl-manifest-path', dest='egl_manifest_path', action='store',
help='Path to the Epic Games Launcher\'s Manifests folder, should ' help='Path to the Epic Games Launcher\'s Manifests folder, should '
@ -2005,8 +2009,9 @@ def main():
help='Only print info available offline') help='Only print info available offline')
info_parser.add_argument('--json', dest='json', action='store_true', info_parser.add_argument('--json', dest='json', action='store_true',
help='Output information in JSON format') help='Output information in JSON format')
info_parser.add_argument('--platform', dest='platform', action='store', metavar='<Platform>', default='Windows', info_parser.add_argument('--platform', dest='platform', action='store', metavar='<Platform>',
type=str, help='Platform to fetch info for (default: installed or Windows)') default='Mac' if sys_platform == 'darwin' else 'Windows', type=str,
help='Platform to fetch info for (default: installed or Mac on macOS, Windows otherwise)')
args, extra = parser.parse_known_args() args, extra = parser.parse_known_args()