]> git.ipfire.org Git - location/libloc.git/commitdiff
location(8): Export all countries by default
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 5 Jun 2020 09:47:36 +0000 (09:47 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 5 Jun 2020 09:47:36 +0000 (09:47 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/python/location.in

index 5c1effd2d920def5c82b4e24f74576c1752ea44f..6ced5f5f099064c8001b3f2ca88a2e42a901da44 100644 (file)
@@ -169,7 +169,7 @@ class CLI(object):
                export.add_argument("--family",
                        help=_("Specify address family"), choices=("ipv6", "ipv4"),
                )
-               export.add_argument("objects", nargs="+", help=_("List country codes or ASNs to export"))
+               export.add_argument("objects", nargs="*", help=_("List country codes or ASNs to export"))
                export.set_defaults(func=self.handle_export)
 
                args = parser.parse_args()
@@ -539,9 +539,9 @@ class CLI(object):
                                log.warning("Invalid argument: %s" % object)
                                continue
 
+               # Default to exporting all countries
                if not countries and not asns:
-                       log.error("Nothing to export")
-                       return 2
+                       countries = ["A1", "A2", "A3"] + [country.code for country in db.countries]
 
                # Select the output format
                writer = self.__get_output_formatter(ns)