Commit da3e360e authored by Michael Tremer's avatar Michael Tremer

location-query: Implement searching for an AS that matches a string

Signed-off-by: default avatarMichael Tremer <michael.tremer@ipfire.org>
parent 98f772f3
......@@ -65,6 +65,13 @@ class CLI(object):
get_as.add_argument("asn", nargs="+")
get_as.set_defaults(func=self.handle_get_as)
# Search for AS
search_as = subparsers.add_parser("search-as",
help=_("Search for Autonomous Systems that match the string"),
)
search_as.add_argument("query", nargs=1)
search_as.set_defaults(func=self.handle_search_as)
return parser.parse_args()
def run(self):
......@@ -148,6 +155,12 @@ class CLI(object):
return ret
def handle_search_as(self, ns):
for query in ns.query:
# Print all matches ASes
for a in self.db.search_as(query):
print(a)
def main():
# Run the command line interface
c = CLI()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment