Compare commits

..

No commits in common. "bd0f850d259742e24d59b93482110bf5c2a4027d" and "263c53bac5e1a7357a5e73f95e180a44b97c5971" have entirely different histories.

7 changed files with 4448 additions and 4314 deletions

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 809 KiB

After

Width:  |  Height:  |  Size: 812 KiB

View File

@ -1,4 +1,4 @@
.TH AHRIMAN "1" "2023\-07\-28" "ahriman" "Generated Python Manual" .TH AHRIMAN "1" "2023\-07\-22" "ahriman" "Generated Python Manual"
.SH NAME .SH NAME
ahriman ahriman
.SH SYNOPSIS .SH SYNOPSIS
@ -733,7 +733,7 @@ path to unix socket used for interprocess communications
.SH COMMAND \fI\,'ahriman service\-shell'\/\fR .SH COMMAND \fI\,'ahriman service\-shell'\/\fR
usage: ahriman service\-shell [\-h] [code] usage: ahriman service\-shell [\-h] [code]
drop into python shell drop into python shell while having created application
.TP .TP
\fBcode\fR \fBcode\fR

View File

@ -58,9 +58,9 @@ _shtab_ahriman_commands() {
"service-config-validate:validate configuration and print found errors" "service-config-validate:validate configuration and print found errors"
"service-key-import:import PGP key from public sources to the repository user" "service-key-import:import PGP key from public sources to the repository user"
"service-setup:create initial service configuration, requires root" "service-setup:create initial service configuration, requires root"
"service-shell:drop into python shell" "service-shell:drop into python shell while having created application"
"setup:create initial service configuration, requires root" "setup:create initial service configuration, requires root"
"shell:drop into python shell" "shell:drop into python shell while having created application"
"sign:(re-)sign packages and repository database according to current settings" "sign:(re-)sign packages and repository database according to current settings"
"status:request status of the package" "status:request status of the package"
"status-update:update package status on the status page" "status-update:update package status on the status page"

View File

@ -1,7 +1,7 @@
# Maintainer: Evgeniy Alekseev # Maintainer: Evgeniy Alekseev
pkgname='ahriman' pkgname='ahriman'
pkgver=2.10.1 pkgver=2.10.0
pkgrel=1 pkgrel=1
pkgdesc="ArcH linux ReposItory MANager" pkgdesc="ArcH linux ReposItory MANager"
arch=('any') arch=('any')

View File

@ -904,7 +904,8 @@ def _set_service_shell_parser(root: SubParserAction) -> argparse.ArgumentParser:
argparse.ArgumentParser: created argument parser argparse.ArgumentParser: created argument parser
""" """
parser = root.add_parser("service-shell", aliases=["shell"], help="invoke python shell", parser = root.add_parser("service-shell", aliases=["shell"], help="invoke python shell",
description="drop into python shell", formatter_class=_formatter) description="drop into python shell while having created application",
formatter_class=_formatter)
parser.add_argument("code", help="instead of dropping into shell, just execute the specified code", nargs="?") 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.add_argument("-v", "--verbose", help=argparse.SUPPRESS, action="store_true")
parser.set_defaults(handler=handlers.Shell, lock=None, report=False) parser.set_defaults(handler=handlers.Shell, lock=None, report=False)

View File

@ -23,6 +23,7 @@ import sys
from pathlib import Path from pathlib import Path
from ahriman.application.application import Application
from ahriman.application.handlers import Handler from ahriman.application.handlers import Handler
from ahriman.core.configuration import Configuration from ahriman.core.configuration import Configuration
from ahriman.core.formatters import StringPrinter from ahriman.core.formatters import StringPrinter
@ -46,12 +47,14 @@ class Shell(Handler):
configuration(Configuration): configuration instance configuration(Configuration): configuration instance
report(bool): force enable or disable reporting report(bool): force enable or disable reporting
""" """
# pylint: disable=possibly-unused-variable
application = Application(architecture, configuration, report=report)
if args.verbose: if args.verbose:
# licensed by https://creativecommons.org/licenses/by-sa/3.0 # licensed by https://creativecommons.org/licenses/by-sa/3.0
path = Path(sys.prefix) / "share" / "ahriman" / "templates" / "shell" path = Path(sys.prefix) / "share" / "ahriman" / "templates" / "shell"
StringPrinter(path.read_text(encoding="utf8")).print(verbose=False) StringPrinter(path.read_text(encoding="utf8")).print(verbose=False)
local_variables = {"architecture": architecture, "configuration": configuration} # we only want to pass application instance inside
if args.code is None: if args.code is None:
code.interact(local=local_variables) code.interact(local={"application": application})
else: else:
code.InteractiveConsole(locals=local_variables).runcode(args.code) code.InteractiveConsole(locals={"application": application}).runcode(args.code)

View File

@ -17,4 +17,4 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
__version__ = "2.10.1" __version__ = "2.10.0"