[PATCH 4 of 5 WIP] cli: convert 'gearbox ishell' to 'kallithea-cli ishell'
Thomas De Schampheleire
patrickdepinguin at gmail.com
Tue Oct 2 20:42:35 UTC 2018
# HG changeset patch
# User Thomas De Schampheleire <thomas.de_schampheleire at nokia.com>
# Date 1538422696 -7200
# Mon Oct 01 21:38:16 2018 +0200
# Node ID c822ec47027e8df140b8d1e2256427c0e109074a
# Parent c4f4a73ab071a75262ab204e162df94e5c657165
cli: convert 'gearbox ishell' to 'kallithea-cli ishell'
--
Question: what is the purpose of the imports 'used in IPython shell' ?
I don't see a difference when e.g. removing the import of datetime.
diff --git a/kallithea/bin/kallithea_cli.py b/kallithea/bin/kallithea_cli.py
--- a/kallithea/bin/kallithea_cli.py
+++ b/kallithea/bin/kallithea_cli.py
@@ -15,6 +15,7 @@
import click
from kallithea.bin.kallithea_cli_config import config
+from kallithea.bin.kallithea_cli_ishell import ishell
@click.group()
def cli():
@@ -22,3 +23,4 @@ def cli():
pass
cli.add_command(config)
+cli.add_command(ishell)
diff --git a/kallithea/lib/paster_commands/ishell.py b/kallithea/bin/kallithea_cli_ishell.py
rename from kallithea/lib/paster_commands/ishell.py
rename to kallithea/bin/kallithea_cli_ishell.py
--- a/kallithea/lib/paster_commands/ishell.py
+++ b/kallithea/bin/kallithea_cli_ishell.py
@@ -12,41 +12,34 @@
# 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.
+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 sys
-# imports, used in IPython shell
+import kallithea.bin.kallithea_cli_util as cli_util
+
+# 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.")
+ at click.command()
+ at cli_util.auto_setup_app()
+def ishell(config_file):
+ """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.")
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -162,7 +162,6 @@ setuptools.setup(
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
More information about the kallithea-general
mailing list