Commit 78f37815 authored by Michael Tremer's avatar Michael Tremer

location-query: Print usage when no action was given

Signed-off-by: default avatarMichael Tremer <michael.tremer@ipfire.org>
parent ccc7ab4e
......@@ -80,15 +80,19 @@ class CLI(object):
search_as.add_argument("country_code", nargs=1)
search_as.set_defaults(func=self.handle_list_networks_by_cc)
return parser.parse_args()
args = parser.parse_args()
# Print usage if no action was given
if not "func" in args:
parser.print_usage()
sys.exit(2)
return args
def run(self):
# Parse command line arguments
args = self.parse_cli()
# Callback function must be defined
assert args.func, "Callback function not defined"
# Open database
try:
db = location.Database(args.database)
......
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