예제 #1
0
파일: app.py 프로젝트: thooth-inc/Mailpile
    def command(self):
        session, config = self.session, self.session.config

        session.interactive = True
        if sys.stdout.isatty() and sys.platform[:3] != "win":
            session.ui.term = ANSIColors()

        # Create and start the rest of the threads, load the index.
        if config.loaded_config:
            Load(session, '').run(quiet=True)
        else:
            config.prepare_workers(session, daemons=True)

        # Note: We do *not* update the MOTD on startup, to keep things
        #       fast, and to avoid leaking our IP on setup, before Tor
        #       has been configured.
        splash = HelpSplash(session, 'help', []).run()
        motd = MessageOfTheDay(session, 'motd', ['--noupdate']).run()
        session.ui.display_result(splash)
        print  # FIXME: This is a hack!
        session.ui.display_result(motd)

        Interact(session)

        return self._success(_('Ran interactive shell'))
예제 #2
0
파일: app.py 프로젝트: Ayzak/Mailpile
    def command(self):
        session, config = self.session, self.session.config

        session.interactive = True
        if sys.stdout.isatty() and sys.platform != "win32":
            session.ui.term = ANSIColors()

        # Create and start the rest of the threads, load the index.
        if config.loaded_config:
            Load(session, '').run(quiet=True)
        else:
            config.prepare_workers(session, daemons=True)

        session.ui.display_result(HelpSplash(session, 'help', []).run())
        Interact(session)

        return self._success(_('Ran interactive shell'))
예제 #3
0
파일: app.py 프로젝트: zouxc-zz/Mailpile
        try:
            shorta = ''.join([k for k in COMMANDS.keys() if not k[0] == '_'])
            longa = [v[0] for v in COMMANDS.values()]
            opts, args = getopt.getopt(args, shorta, longa)
            for opt, arg in opts:
                Action(session, opt.replace('-', ''), arg)
            if args:
                Action(session, args[0], ' '.join(args[1:]))

        except (getopt.GetoptError, UsageError), e:
            session.error(e)

        if not opts and not args:
            # Create and start the rest of the threads, load the index.
            config.prepare_workers(session, daemons=True)
            Load(session, '').run(quiet=True)
            session.ui.display_result(Help(session, 'Help', ['splash']).run())
            session.interactive = session.ui.interactive = True
            Interact(session)

    except KeyboardInterrupt:
        pass

    finally:
        mailpile.util.QUITTING = True
        config.stop_workers()


if __name__ == "__main__":
    Main(sys.argv[1:])