From 7c1985a077321b8085ad87009674c74c10689912 Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Tue, 14 Apr 2020 18:46:54 +0200 Subject: Exit gracefully when there are no updates --- .local/bin/zypper-wassup | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.local/bin/zypper-wassup b/.local/bin/zypper-wassup index 6486367..749052a 100755 --- a/.local/bin/zypper-wassup +++ b/.local/bin/zypper-wassup @@ -26,7 +26,8 @@ SOURCERPM_PATTERN = re.compile( '-'.join(('(?P.+)', '(?P[^-]+)', '(?P[^-]+)')), '(?:no)?src', 'rpm' -))) + )) +) def execute(command): @@ -127,6 +128,9 @@ def main(): packages = zypper_list_updates() print(f'{len(packages)} updates.') + if not packages: + return + widths = { field: max(len(p._asdict()[field]) for p in packages) for field in Package._fields -- cgit v1.2.3