From 5f1afd89eef493eb823502f6fd52f7b4254e8266 Mon Sep 17 00:00:00 2001 From: jpic Date: Fri, 28 Aug 2020 18:56:28 +0200 Subject: [PATCH] Prevent print traceback for failed commands --- shlax/cli.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/shlax/cli.py b/shlax/cli.py index 487ab88..13a6926 100644 --- a/shlax/cli.py +++ b/shlax/cli.py @@ -13,6 +13,8 @@ import importlib import os import sys +from .proc import ProcFailure + class Group(cli2.Group): def __init__(self, *args, **kwargs): @@ -55,7 +57,12 @@ class Command(cli2.Command): return self.shlax_target(*args) def __call__(self, *argv): - super().__call__(*argv) + try: + super().__call__(*argv) + except ProcFailure: + # just output the failure without TB, as command was already + # printed anyway + pass self.shlax_target.output.results(self.shlax_target)