commit 01445b45c7a7c31d732339989a71c957a633bad6
parent cc1e0defe58a83c1d59a31d72b7e8e7dec726883
Author: Christoph Lohmann <20h@r-36.net>
Date: Sat, 10 Feb 2018 16:18:47 +0100
Add debug mode with ipython.
Diffstat:
1 file changed, 13 insertions(+), 0 deletions(-)
diff --git a/zs b/zs
@@ -122,6 +122,16 @@ def run(db, selfeed=None, dryrun=False, onlychanges=False):
except smtplib.SMTPSenderRefused:
return
+class ExceptionHook:
+ instance = None
+
+ def __call__(self, *args, **kwargs):
+ if self.instance is None:
+ from IPython.core import ultratb
+ self.instance = ultratb.FormattedTB(mode='Verbose',
+ color_scheme='Linux', call_pdb=1)
+ return self.instance(*args, **kwargs)
+
def usage(app):
app = os.path.basename(app)
sys.stderr.write("usage: %s [-dhs] cmd\n" % (app))
@@ -151,6 +161,9 @@ def main(args):
if len(largs) < 1:
usage(args[0])
+ if dodebug == True:
+ sys.excepthook = ExceptionHook()
+
if largs[0] == "testfeed":
if len(largs) < 2:
print("usage: %s testfeed URI\n" % \