diff --git a/i3pystatus/updates/cower.py b/i3pystatus/updates/cower.py index 144f156..2700444 100644 --- a/i3pystatus/updates/cower.py +++ b/i3pystatus/updates/cower.py @@ -13,6 +13,12 @@ class Cower(Backend): def updates(self): command = ["cower", "-u"] cower = run_through_shell(command) - return cower.out.count('\n') + return cower.out.count('\n'), cower.out Backend = Cower + +if __name__ == "__main__": + """ + Call this module directly; Print the update count and notification body. + """ + print("Updates: {}\n\n{}".format(*Backend().updates)) diff --git a/i3pystatus/updates/dnf.py b/i3pystatus/updates/dnf.py index 8ea8a77..c57ee4b 100644 --- a/i3pystatus/updates/dnf.py +++ b/i3pystatus/updates/dnf.py @@ -35,5 +35,4 @@ if __name__ == "__main__": """ Call this module directly; Print the update count and notification body. """ - dnf = Dnf() - print("Updates: {}\n\n{}".format(*dnf.updates)) + print("Updates: {}\n\n{}".format(*Backend().updates)) diff --git a/i3pystatus/updates/pacman.py b/i3pystatus/updates/pacman.py index 8f40945..45ac537 100644 --- a/i3pystatus/updates/pacman.py +++ b/i3pystatus/updates/pacman.py @@ -12,6 +12,12 @@ class Pacman(Backend): def updates(self): command = ["checkupdates"] checkupdates = run_through_shell(command) - return checkupdates.out.count('\n') + return checkupdates.out.count("\n"), checkupdates.out Backend = Pacman + +if __name__ == "__main__": + """ + Call this module directly; Print the update count and notification body. + """ + print("Updates: {}\n\n{}".format(*Backend().updates)) diff --git a/i3pystatus/updates/yaourt.py b/i3pystatus/updates/yaourt.py index 3738ff6..e43b9e9 100644 --- a/i3pystatus/updates/yaourt.py +++ b/i3pystatus/updates/yaourt.py @@ -25,8 +25,15 @@ class Yaourt(Backend): def updates(self): command = ["yaourt", "-Qua"] checkupdates = run_through_shell(command) + out = checkupdates.out if(self.aur_only): - return len(re.findall("^aur/", checkupdates.out, flags=re.M)) - return checkupdates.out.count("\n") + out = [line for line in out if line.startswith("aur")] + return out.count("\n"), out Backend = Yaourt + +if __name__ == "__main__": + """ + Call this module directly; Print the update count and notification body. + """ + print("Updates: {}\n\n{}".format(*Backend().updates))