From 27be2bdb251a291b713b4080973c4376615260a8 Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Fri, 24 Sep 2010 15:00:31 -0400 Subject: [PATCH] use bold in prompt --- weboob/tools/application/repl.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/weboob/tools/application/repl.py b/weboob/tools/application/repl.py index 88e5c6c7..227ff9c8 100644 --- a/weboob/tools/application/repl.py +++ b/weboob/tools/application/repl.py @@ -51,10 +51,14 @@ class ReplApplication(Cmd, BaseApplication): SYNOPSIS = 'Usage: %prog [-dqv] [-b backends] [-cnfs] [command [arguments..]]\n' SYNOPSIS += ' %prog [--help] [--version]' + # shell escape strings + BOLD = '' + NC = '' # no color + def __init__(self): Cmd.__init__(self) - self.prompt = '%s> ' % self.APPNAME - self.intro = '\n'.join(('Welcome to %s v%s' % (self.APPNAME, self.VERSION), + self.prompt = self.BOLD + '%s> ' % self.APPNAME + self.NC + self.intro = '\n'.join(('Welcome to %s%s%s v%s' % (self.BOLD, self.APPNAME, self.NC, self.VERSION), '', '%s' % self.COPYRIGHT, 'This program is free software; you can redistribute it and/or modify', @@ -113,6 +117,12 @@ class ReplApplication(Cmd, BaseApplication): readline.write_history_file(history_filepath) atexit.register(savehist) + self._interactive = False + + @property + def interactive(self): + return self._interactive + def set_requested_backends(self, requested_backends): self.load_default_backends() if requested_backends: @@ -171,6 +181,7 @@ class ReplApplication(Cmd, BaseApplication): self.onecmd(cmd) else: self.intro += '\nLoaded backends: %s\n' % ', '.join(sorted(backend.name for backend in self.weboob.iter_backends())) + self._interactive = True self.cmdloop() def do(self, function, *args, **kwargs):