From: Frank Brehm Date: Mon, 15 Apr 2024 14:25:41 +0000 (+0200) Subject: Using a limit in output results of bin/get-intern-used-from-addresses X-Git-Url: https://git.uhu-banane.net/?a=commitdiff_plain;h=8b7840d0ea79a9c750a131b3c7f13bf7899a73f9;p=pixelpark%2Fpp-admin-tools.git Using a limit in output results of bin/get-intern-used-from-addresses --- diff --git a/lib/pp_admintools/app/get_from_addr.py b/lib/pp_admintools/app/get_from_addr.py index 6313692..42f64b6 100644 --- a/lib/pp_admintools/app/get_from_addr.py +++ b/lib/pp_admintools/app/get_from_addr.py @@ -191,6 +191,8 @@ class GetFromAddressesApp(BaseDPXApplication): if getattr(self.args, 'show_address_results', False): self.show_address_results = True + self.limit = getattr(self.args, 'limit', self.default_limit) + if self.args.logfiles: self._eval_given_logfiles() else: @@ -448,6 +450,9 @@ class GetFromAddressesApp(BaseDPXApplication): lh_out = '' count = self.per_address[loghost][address] + if count < self.limit: + break + print(template.format(h=lh_out, a=address, c=count)) first = False @@ -494,6 +499,9 @@ class GetFromAddressesApp(BaseDPXApplication): lh_out = '' count = self.per_domain[loghost][domain] + if count < self.limit: + break + print(template.format(h=lh_out, d=domain, c=count)) first = False