diff --git a/src/ahriman/application/ahriman.py b/src/ahriman/application/ahriman.py index c93af244..1a0f6fde 100644 --- a/src/ahriman/application/ahriman.py +++ b/src/ahriman/application/ahriman.py @@ -904,8 +904,7 @@ def _set_service_shell_parser(root: SubParserAction) -> argparse.ArgumentParser: argparse.ArgumentParser: created argument parser """ parser = root.add_parser("service-shell", aliases=["shell"], help="invoke python shell", - description="drop into python shell while having created application", - formatter_class=_formatter) + description="drop into python shell", formatter_class=_formatter) parser.add_argument("code", help="instead of dropping into shell, just execute the specified code", nargs="?") parser.add_argument("-v", "--verbose", help=argparse.SUPPRESS, action="store_true") parser.set_defaults(handler=handlers.Shell, lock=None, report=False) diff --git a/src/ahriman/application/handlers/shell.py b/src/ahriman/application/handlers/shell.py index e4d39c44..ef9fb531 100644 --- a/src/ahriman/application/handlers/shell.py +++ b/src/ahriman/application/handlers/shell.py @@ -23,7 +23,6 @@ import sys from pathlib import Path -from ahriman.application.application import Application from ahriman.application.handlers import Handler from ahriman.core.configuration import Configuration from ahriman.core.formatters import StringPrinter @@ -47,14 +46,12 @@ class Shell(Handler): configuration(Configuration): configuration instance report(bool): force enable or disable reporting """ - # pylint: disable=possibly-unused-variable - application = Application(architecture, configuration, report=report) if args.verbose: # licensed by https://creativecommons.org/licenses/by-sa/3.0 path = Path(sys.prefix) / "share" / "ahriman" / "templates" / "shell" StringPrinter(path.read_text(encoding="utf8")).print(verbose=False) - # we only want to pass application instance inside + local_variables = {"architecture": architecture, "configuration": configuration} if args.code is None: - code.interact(local={"application": application}) + code.interact(local=local_variables) else: - code.InteractiveConsole(locals={"application": application}).runcode(args.code) + code.InteractiveConsole(locals=local_variables).runcode(args.code)