]> git.ipfire.org Git - dbl.git/commitdiff
dnsbl: Allow to specify an output file for single exports
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 8 Dec 2025 17:00:24 +0000 (17:00 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 8 Dec 2025 17:00:24 +0000 (17:00 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/scripts/dnsbl.in

index 2911be275db3c64f19491e5ccfc44b0344ad786a..b3e91884a4840f9d9c04fc511b7ae53008240b45 100644 (file)
@@ -98,6 +98,8 @@ class CLI(object):
                # export
                export = subparsers.add_parser("export", help=_("Exports a list"))
                export.add_argument("list", help=_("The name of the list"))
+               export.add_argument("output", type=argparse.FileType("w"),
+                               help=_("The output file"))
                export.add_argument("--format", default="domains",
                                choices=("domains", "hosts", "rpz",), help=_("Output Format"))
                export.set_defaults(func=self.__export)
@@ -280,7 +282,7 @@ class CLI(object):
                list = backend.lists.get_by_slug(args.list)
 
                # Export!
-               list.export(sys.stdout, format=args.format)
+               list.export(args.output, format=args.format)
 
        def __export_all(self, backend, args):
                """