]> Frank Brehm's Git Trees - pixelpark/pp-admin-tools.git/commitdiff
Using a limit in output results of bin/get-intern-used-from-addresses
authorFrank Brehm <frank.brehm@pixelpark.com>
Mon, 15 Apr 2024 14:25:41 +0000 (16:25 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Mon, 15 Apr 2024 14:25:41 +0000 (16:25 +0200)
lib/pp_admintools/app/get_from_addr.py

index 6313692576779ee03e476fcc07bf11c4e3de928d..42f64b64c4bfe443bafe4567848f54a6e9f76d48 100644 (file)
@@ -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