##// END OF EJS Templates
ishell: updated code with latest ishell changes.
marcink -
r1241:190eec84 default
parent child Browse files
Show More
@@ -1,73 +1,80 b''
1 1 # -*- coding: utf-8 -*-
2 2
3 3 # Copyright (C) 2013-2016 RhodeCode GmbH
4 4 #
5 5 # This program is free software: you can redistribute it and/or modify
6 6 # it under the terms of the GNU Affero General Public License, version 3
7 7 # (only), as published by the Free Software Foundation.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU Affero General Public License
15 15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 16 #
17 17 # This program is dual-licensed. If you wish to learn more about the
18 18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20 20
21 21 """
22 22 interactive shell paster command for RhodeCode
23 23 """
24 24
25 25 import os
26 26 import sys
27 27 import logging
28 28
29 29 from rhodecode.lib.utils import BasePasterCommand
30 30
31 31 # fix rhodecode import
32 32 from os.path import dirname as dn
33 33 rc_path = dn(dn(dn(os.path.realpath(__file__))))
34 34 sys.path.append(rc_path)
35 35
36 36 log = logging.getLogger(__name__)
37 37
38 welcome_banner = """Welcome to RhodeCode iShell.
39 Type `exit` to exit the shell.
40 iShell is interactive shell to interact directly with the
41 internal RhodeCode APIs. You can rescue your lost password,
42 or reset some user/system settings.
43 """
44
38 45
39 46 class Command(BasePasterCommand):
40 47
41 48 max_args = 1
42 49 min_args = 1
43 50
44 51 usage = "CONFIG_FILE"
45 52 group_name = "RhodeCode"
46 53 takes_config_file = -1
47 54 parser = BasePasterCommand.standard_parser(verbose=True)
48 55 summary = "Interactive shell"
49 56
50 57 def command(self):
51 58 #get SqlAlchemy session
52 59 self._init_session()
53 60
54 61 # imports, used in ipython shell
55 62 import os
56 63 import sys
57 64 import time
58 65 import shutil
59 66 import datetime
60 67 from rhodecode.model.db import *
61 68
62 69 try:
63 70 from IPython import embed
64 from IPython.config.loader import Config
71 from traitlets.config import Config
65 72 cfg = Config()
66 73 cfg.InteractiveShellEmbed.confirm_exit = False
67 embed(config=cfg, banner1="RhodeCode IShell.")
74 embed(config=cfg, banner1=welcome_banner)
68 75 except ImportError:
69 print 'ipython installation required for ishell'
76 print('ipython installation required for ishell')
70 77 sys.exit(-1)
71 78
72 79 def update_parser(self):
73 80 pass
General Comments 0
You need to be logged in to leave comments. Login now