1
0
Fork 0
mirror of synced 2024-06-27 02:30:31 +12:00

Add dry run argument to launch helper

This commit is contained in:
lennard 2023-02-12 17:13:05 +01:00 committed by loathingKernel
parent b4586c9272
commit d42a631713
No known key found for this signature in database
GPG key ID: CE0C72D0B53821FD
3 changed files with 17 additions and 1 deletions

View file

@ -49,6 +49,7 @@ def main():
launch_minimal_parser = subparsers.add_parser("start", aliases=["launch"])
launch_minimal_parser.add_argument("app_name", help="AppName of the game to launch",
metavar="<App Name>", action="store")
launch_minimal_parser.add_argument("--dry-run", help="Print arguments and exit", action="store_true")
launch_minimal_parser.add_argument("--offline", help="Launch game offline",
action="store_true")
launch_minimal_parser.add_argument('--wine-bin', dest='wine_bin', action='store', metavar='<wine binary>',

View file

@ -20,6 +20,7 @@ from rare.widgets.rare_app import RareApp, RareAppException
from .console import Console
from .lgd_helper import get_launch_args, InitArgs, get_configured_process, LaunchArgs, GameArgsError
logger = logging.getLogger("RareLauncher")
DETACHED_APP_NAMES = [
@ -101,6 +102,10 @@ class RareLauncher(RareApp):
self.app_name = args.app_name
self.logger = getLogger(self.app_name)
self.core = LegendaryCore()
self.args = args
# game = self.core.get_game(self.app_name)
# self.rgame = RareGame(self.core, None, game)
lang = self.settings.value("language", self.core.language_code, type=str)
self.load_translator(lang)
@ -208,6 +213,15 @@ class RareLauncher(RareApp):
self.console.log("Launching game detached")
self.stop()
return
if self.args.dry_run:
logger.info("Dry run activated")
if self.console:
self.console.log(f"{args.executable} {' '.join(args.args)}")
self.console.log(f"Do not start {self.app_name}")
self.console.accept_close = True
print(args.executable, " ".join(args.args))
self.stop()
self.game_process.start(args.executable, args.args)
def error_occurred(self, error_str: str):

View file

@ -21,6 +21,7 @@ class GameArgsError(Exception):
@dataclass
class InitArgs:
app_name: str
dry_run: bool = False
debug: bool = False
offline: bool = False
skip_update_check: bool = False
@ -29,7 +30,6 @@ class InitArgs:
@classmethod
def from_argparse(cls, args):
print(args.skip_update_check)
return cls(
app_name=args.app_name,
debug=args.debug,
@ -37,6 +37,7 @@ class InitArgs:
skip_update_check=args.skip_update_check,
wine_bin=args.wine_bin,
wine_prefix=args.wine_pfx,
dry_run=args.dry_run
)