Add dry run argument to launch helper
This commit is contained in:
parent
b4586c9272
commit
d42a631713
3 changed files with 17 additions and 1 deletions
|
@ -49,6 +49,7 @@ def main():
|
||||||
launch_minimal_parser = subparsers.add_parser("start", aliases=["launch"])
|
launch_minimal_parser = subparsers.add_parser("start", aliases=["launch"])
|
||||||
launch_minimal_parser.add_argument("app_name", help="AppName of the game to launch",
|
launch_minimal_parser.add_argument("app_name", help="AppName of the game to launch",
|
||||||
metavar="<App Name>", action="store")
|
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",
|
launch_minimal_parser.add_argument("--offline", help="Launch game offline",
|
||||||
action="store_true")
|
action="store_true")
|
||||||
launch_minimal_parser.add_argument('--wine-bin', dest='wine_bin', action='store', metavar='<wine binary>',
|
launch_minimal_parser.add_argument('--wine-bin', dest='wine_bin', action='store', metavar='<wine binary>',
|
||||||
|
|
|
@ -20,6 +20,7 @@ from rare.widgets.rare_app import RareApp, RareAppException
|
||||||
from .console import Console
|
from .console import Console
|
||||||
from .lgd_helper import get_launch_args, InitArgs, get_configured_process, LaunchArgs, GameArgsError
|
from .lgd_helper import get_launch_args, InitArgs, get_configured_process, LaunchArgs, GameArgsError
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger("RareLauncher")
|
logger = logging.getLogger("RareLauncher")
|
||||||
|
|
||||||
DETACHED_APP_NAMES = [
|
DETACHED_APP_NAMES = [
|
||||||
|
@ -101,6 +102,10 @@ class RareLauncher(RareApp):
|
||||||
self.app_name = args.app_name
|
self.app_name = args.app_name
|
||||||
self.logger = getLogger(self.app_name)
|
self.logger = getLogger(self.app_name)
|
||||||
self.core = LegendaryCore()
|
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)
|
lang = self.settings.value("language", self.core.language_code, type=str)
|
||||||
self.load_translator(lang)
|
self.load_translator(lang)
|
||||||
|
@ -208,6 +213,15 @@ class RareLauncher(RareApp):
|
||||||
self.console.log("Launching game detached")
|
self.console.log("Launching game detached")
|
||||||
self.stop()
|
self.stop()
|
||||||
return
|
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)
|
self.game_process.start(args.executable, args.args)
|
||||||
|
|
||||||
def error_occurred(self, error_str: str):
|
def error_occurred(self, error_str: str):
|
||||||
|
|
|
@ -21,6 +21,7 @@ class GameArgsError(Exception):
|
||||||
@dataclass
|
@dataclass
|
||||||
class InitArgs:
|
class InitArgs:
|
||||||
app_name: str
|
app_name: str
|
||||||
|
dry_run: bool = False
|
||||||
debug: bool = False
|
debug: bool = False
|
||||||
offline: bool = False
|
offline: bool = False
|
||||||
skip_update_check: bool = False
|
skip_update_check: bool = False
|
||||||
|
@ -29,7 +30,6 @@ class InitArgs:
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_argparse(cls, args):
|
def from_argparse(cls, args):
|
||||||
print(args.skip_update_check)
|
|
||||||
return cls(
|
return cls(
|
||||||
app_name=args.app_name,
|
app_name=args.app_name,
|
||||||
debug=args.debug,
|
debug=args.debug,
|
||||||
|
@ -37,6 +37,7 @@ class InitArgs:
|
||||||
skip_update_check=args.skip_update_check,
|
skip_update_check=args.skip_update_check,
|
||||||
wine_bin=args.wine_bin,
|
wine_bin=args.wine_bin,
|
||||||
wine_prefix=args.wine_pfx,
|
wine_prefix=args.wine_pfx,
|
||||||
|
dry_run=args.dry_run
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue