[PATCH 04 of 17 v3] cli: convert 'gearbox ishell' into 'kallithea-cli ishell'

Thomas De Schampheleire patrickdepinguin at gmail.com
Thu Oct 18 20:49:27 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 4698ed62a2a7b863c2db3e04e9b0a071a37cad92
# Parent  9d368360e821838c058aeee6e3f0e7108229b514
cli: convert 'gearbox ishell' into 'kallithea-cli ishell'

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
@@ -17,3 +17,4 @@ from kallithea.bin.kallithea_cli_base im
 
 # import commands (they will add themselves to the 'cli' object)
 import kallithea.bin.kallithea_cli_config
+import kallithea.bin.kallithea_cli_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,32 @@
 # 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
+from kallithea.bin.kallithea_cli_base import cli
+import kallithea.bin.kallithea_cli_util as cli_util
 
 import sys
 
-# imports, used in IPython shell
-import time
-import shutil
-import datetime
+# make following imports directly available inside the ishell
 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 cli.command()
+ at cli_util.auto_setup_app()
+def ishell_run(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