summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@gmail.com>2020-04-14 18:46:54 +0200
committerKévin Le Gouguec <kevin.legouguec@gmail.com>2020-04-14 19:00:45 +0200
commit7c1985a077321b8085ad87009674c74c10689912 (patch)
treec657d2d570615d974021d1db7770d0429b571197
parent3593f50aedce5544e7a03e85421ea4b9c1752462 (diff)
downloaddotfiles-7c1985a077321b8085ad87009674c74c10689912.tar.xz
Exit gracefully when there are no updates
-rwxr-xr-x.local/bin/zypper-wassup6
1 files changed, 5 insertions, 1 deletions
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<name>.+)', '(?P<version>[^-]+)', '(?P<release>[^-]+)')),
'(?: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