From: Michael Tremer Date: Sat, 6 Dec 2025 17:07:50 +0000 (+0000) Subject: dnsbl: Remove the "list-" prefix from all commands X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8e20dc7a7ffd505c765566cf00af25e98fd1d5e;p=dbl.git dnsbl: Remove the "list-" prefix from all commands Signed-off-by: Michael Tremer --- diff --git a/src/dnsbl/__init__.py b/src/dnsbl/__init__.py index caf050f..6571c64 100644 --- a/src/dnsbl/__init__.py +++ b/src/dnsbl/__init__.py @@ -84,9 +84,3 @@ class Backend(object): @functools.cached_property def sources(self): return sources.Sources(self) - - def update_sources(self): - """ - Updates all sources - """ - pass diff --git a/src/scripts/dnsbl.in b/src/scripts/dnsbl.in index 82082c1..8a4da1b 100644 --- a/src/scripts/dnsbl.in +++ b/src/scripts/dnsbl.in @@ -53,52 +53,48 @@ class CLI(object): parser.add_argument("--version", action="version", version="%(prog)s @VERSION@") # lists - lists = subparsers.add_parser("lists", help=_("Show all lists")) - lists.set_defaults(func=self.__lists) + list = subparsers.add_parser("list", help=_("Show all lists")) + list.set_defaults(func=self.__list) - # list-create - list_create = subparsers.add_parser("list-create", help=_("Create a new list")) - list_create.add_argument("--name", required=True, + # create + create = subparsers.add_parser("create", help=_("Create a new list")) + create.add_argument("--name", required=True, help=_("The name of the list")) - list_create.add_argument("--created-by", required=True, + create.add_argument("--created-by", required=True, default=os.environ.get("USER"), help=_("The creator of the list")) - list_create.add_argument("--license", required=True, + create.add_argument("--license", required=True, help=_("The license of the list")) - list_create.set_defaults(func=self.__list_create) + create.set_defaults(func=self.__create) - # list-show - list_show = subparsers.add_parser("list-show", help=_("Shows details about a list")) - list_show.add_argument("list", help=_("The name of the list")) - list_show.set_defaults(func=self.__list_show) + # show + show = subparsers.add_parser("show", help=_("Shows details about a list")) + show.add_argument("list", help=_("The name of the list")) + show.set_defaults(func=self.__show) - # list-update - list_update = subparsers.add_parser("list-update", help=_("Updates a list")) - list_update.add_argument("list", help=_("The name of the list")) - list_update.set_defaults(func=self.__list_update) + # update + update = subparsers.add_parser("update", help=_("Updates a list")) + update.add_argument("list", help=_("The name of the list")) + update.set_defaults(func=self.__update) - # list-export - list_export = subparsers.add_parser("list-export", help=_("Exports a list")) - list_export.add_argument("list", help=_("The name of the list")) - list_export.set_defaults(func=self.__list_export) + # export + export = subparsers.add_parser("export", help=_("Exports a list")) + export.add_argument("list", help=_("The name of the list")) + export.set_defaults(func=self.__export) - # list-add-source - list_add_source = subparsers.add_parser("list-add-source", + # add-source + add_source = subparsers.add_parser("add-source", help=_("Creates a new source to a list")) - list_add_source.add_argument("list", + add_source.add_argument("list", help=_("The name of the list")) - list_add_source.add_argument("--name", required=True, + add_source.add_argument("--name", required=True, help=_("The name of the source")) - list_add_source.add_argument("--url", required=True, + add_source.add_argument("--url", required=True, help=_("The URL of the source")) - list_add_source.add_argument("--license", required=True, + add_source.add_argument("--license", required=True, help=_("The license of the source")) - list_add_source.add_argument("--created-by", required=True, + add_source.add_argument("--created-by", required=True, default=os.environ.get("USER"), help=_("The creator of the source")) - list_add_source.set_defaults(func=self.__list_add_source) - - # update - update = subparsers.add_parser("update", help=_("Update sources")) - update.set_defaults(func=self.__update) + add_source.set_defaults(func=self.__add_source) # Parse all arguments args = parser.parse_args() @@ -135,7 +131,7 @@ class CLI(object): # Otherwise just exit sys.exit(0) - def __lists(self, backend, args): + def __list(self, backend, args): table = rich.table.Table(title=_("Lists")) table.add_column(_("Name")) table.add_column(_("Slug")) @@ -156,7 +152,7 @@ class CLI(object): # Print the table self.console.print(table) - def __list_create(self, backend, args): + def __create(self, backend, args): """ Creates a new list """ @@ -166,7 +162,7 @@ class CLI(object): license = args.license, ) - def __list_show(self, backend, args): + def __show(self, backend, args): """ Shows information about a list """ @@ -204,7 +200,7 @@ class CLI(object): # Print the sources self.console.print(table) - def __list_update(self, backend, args): + def __update(self, backend, args): """ Updates a single list """ @@ -214,7 +210,7 @@ class CLI(object): # Update! list.update() - def __list_export(self, backend, args): + def __export(self, backend, args): """ Exports a list """ @@ -224,7 +220,7 @@ class CLI(object): # Export! list.export(sys.stdout) - def __list_add_source(self, backend, args): + def __add_source(self, backend, args): """ Adds a new source to a list """ @@ -240,12 +236,6 @@ class CLI(object): license = args.license, ) - def __update(self, backend, args): - """ - Updates all sources - """ - backend.update_sources() - def main(): c = CLI()