Esempio n. 1
0
    def run(self, *args, **kargs):
        """ this is a thing that probably does not belong in a
            settings abstraction, but it is very useful..
        """
        self.pre_run()

        if self.options.cmd:
            ns = globals()
            ns.update(settings=self)
            exec self.options.cmd in self.shell_namespace()
            return True

        if self.options.execfile:
            ns = globals()
            ns.update(settings=self)
            execfile(self.options.execfile, self.shell_namespace())
            return True

        if self.options.version:
            return self.show_version()

        if self.get_setting('user.shell'):
            try:
                from smashlib import embed
            except ImportError:
                raise SettingsError("You need smashlib installed "
                                    "if you want to use the shell.")
            else:
                embed(user_ns=self.shell_namespace())
            return True
Esempio n. 2
0
    def test_git(self):
        self.event.line = "git clo"
        self.event.text_until_cursor = "git clo"
        x = self.plugin.smash_matcher(self.shell, self.event)
        from smashlib import embed

        embed()
Esempio n. 3
0
def shell(conn=None, **namespace):
    conn = conn or get_conn()
    try:
        from smashlib import embed
        embed(user_ns=namespace)
    except ImportError as e:
        print 'you need smashlib or ipython installed to run the shell!'
        print "original error: " + str(e)
        raise
Esempio n. 4
0
def shell(conn=None, **namespace):
    conn = conn or get_conn()
    try:
        from smashlib import embed
        embed(user_ns=namespace)
    except ImportError as e:
        print 'you need smashlib or ipython installed to run the shell!'
        print "original error: " + str(e)
        raise
Esempio n. 5
0
def ymir_shell(args):
    """ """
    service = yapi.load_service_from_json()
    report("starting shell")
    user_ns = dict(conn=util.get_conn(), service=service)
    report("namespace: \n\n{0}\n\n".format(user_ns))
    try:
        from smashlib import embed
    except ImportError:
        raise SystemExit("need smashlib should be installed first")
    embed(user_ns=user_ns, )
Esempio n. 6
0
def main():
    os.environ['SMASH'] = '1'
    hijack_ipython_module()
    # imports below must come after hijack
    from smashlib import embed
    from smashlib.config import SmashConfig, SmashUserConfig
    smash_prof = SmashConfig.ensure()['profile']
    SmashUserConfig.ensure()
    embed(["--profile-dir={0}".format(smash_prof), ],
          # do not let smash inspect the caller context
          # and automatically update globals/locals
          user_ns=None
          )
Esempio n. 7
0
def ymir_shell(args):
    """ """
    service = yapi.load_service_from_json()
    report("starting shell")
    user_ns = dict(
        conn=util.get_conn(),
        service=service)
    report("namespace: \n\n{0}\n\n".format(user_ns))
    try:
        from smashlib import embed
    except ImportError:
        raise SystemExit("need smashlib should be installed first")
    embed(user_ns=user_ns,)