Mercurial > kallithea
changeset 7407:0e0dbb16fcbf
cli: convert 'gearbox ishell' into 'kallithea-cli ishell'
author | Thomas De Schampheleire <thomas.de_schampheleire@nokia.com> |
---|---|
date | Sun, 18 Nov 2018 20:02:17 +0100 |
parents | 7784a1212471 |
children | 0080ffd8aea0 |
files | kallithea/bin/kallithea_cli.py kallithea/bin/kallithea_cli_ishell.py kallithea/lib/paster_commands/ishell.py setup.py |
diffstat | 4 files changed, 42 insertions(+), 53 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/bin/kallithea_cli.py Sun Nov 18 20:02:17 2018 +0100 +++ b/kallithea/bin/kallithea_cli.py Sun Nov 18 20:02:17 2018 +0100 @@ -17,3 +17,4 @@ # import commands (they will add themselves to the 'cli' object) import kallithea.bin.kallithea_cli_config +import kallithea.bin.kallithea_cli_ishell
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kallithea/bin/kallithea_cli_ishell.py Sun Nov 18 20:02:17 2018 +0100 @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +""" +This file was forked by the Kallithea project in July 2014 and later moved. +Original author and date, and relevant copyright and licensing information is below: +:created_on: Apr 4, 2013 +:author: marcink +:copyright: (c) 2013 RhodeCode GmbH, and others. +:license: GPLv3, see LICENSE.md for more details. +""" +import click +import kallithea.bin.kallithea_cli_base as cli_base + +import sys + +# make following imports directly available inside the ishell +from kallithea.model.db import * + +@cli_base.register_command(config_file_initialize_app=True) +def ishell(): + """Interactive shell for Kallithea.""" + try: + from IPython import embed + except ImportError: + print 'Kallithea ishell requires the Python package IPython 4 or later' + sys.exit(-1) + from traitlets.config.loader import Config + cfg = Config() + cfg.InteractiveShellEmbed.confirm_exit = False + embed(config=cfg, banner1="Kallithea IShell.")
--- a/kallithea/lib/paster_commands/ishell.py Sun Nov 18 20:02:17 2018 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -""" -kallithea.lib.paster_commands.ishell -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -interactive shell gearbox command for Kallithea - -This file was forked by the Kallithea project in July 2014. -Original author and date, and relevant copyright and licensing information is below: -:created_on: Apr 4, 2013 -:author: marcink -:copyright: (c) 2013 RhodeCode GmbH, and others. -:license: GPLv3, see LICENSE.md for more details. -""" - - -import sys - -# imports, used in IPython shell -import time -import shutil -import datetime -from kallithea.model.db import * - -from kallithea.lib.paster_commands.common import BasePasterCommand - - -class Command(BasePasterCommand): - "Kallithea: Interactive Python shell" - - def take_action(self, args): - try: - from IPython import embed - except ImportError: - print 'Kallithea ishell requires the Python package IPython 4 or later' - sys.exit(-1) - from traitlets.config.loader import Config - cfg = Config() - cfg.InteractiveShellEmbed.confirm_exit = False - embed(config=cfg, banner1="Kallithea IShell.")
--- a/setup.py Sun Nov 18 20:02:17 2018 +0100 +++ b/setup.py Sun Nov 18 20:02:17 2018 +0100 @@ -163,7 +163,6 @@ celeryd=kallithea.lib.paster_commands.celeryd:Command cleanup-repos=kallithea.lib.paster_commands.cleanup:Command install-iis=kallithea.lib.paster_commands.install_iis:Command - ishell=kallithea.lib.paster_commands.ishell:Command make-index=kallithea.lib.paster_commands.make_index:Command make-rcext=kallithea.lib.paster_commands.make_rcextensions:Command repo-scan=kallithea.lib.paster_commands.repo_scan:Command