From d95aeb2bd3ff99d6f6da2a953b93d47f52278a09 Mon Sep 17 00:00:00 2001 From: Goffi Date: Tue, 12 Dec 2017 00:11:27 +0100 Subject: [PATCH] jp (base): added exitCb generic callback to display a message and quit --- frontends/src/jp/base.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/frontends/src/jp/base.py b/frontends/src/jp/base.py index e0717c78..c9d1cc10 100644 --- a/frontends/src/jp/base.py +++ b/frontends/src/jp/base.py @@ -779,6 +779,16 @@ class CommandBase(object): raise exceptions.InternalError(_(u'trying to use output when use_output has not been set')) return self.host.output(output_type, self.args.output, self.extra_outputs, data) + def exitCb(self, msg=None): + """generic callback for success + + optionally print a message, and quit + msg(None, unicode): if not None, print this message + """ + if msg is not None: + self.disp(msg) + self.host.quit(C.EXIT_OK) + def errback(self, failure_, msg=None, exit_code=C.EXIT_ERROR): """generic callback for errbacks