diff options
Diffstat (limited to 'asn.py')
-rwxr-xr-x | asn.py | 28 |
1 files changed, 19 insertions, 9 deletions
@@ -268,17 +268,27 @@ if __name__ == '__main__': args = parser.parse_args() db = DB() - if args.host and args.port: - listen = Listener(db, args.host, args.port) - elif args.update: + if not len(sys.argv) > 1: + parser.print_help(sys.stderr) + sys.exit() + + if args.populate and args.update: + log.error('--populate and --update used; redundant, use one') + sys.exit() + + if args.populate: + log.info('creating and populating db cache...') + db.populate_db() + + if args.update: log.info('checking remote repository for new dataset...') if db.update(): - log.info('dataset updated, creating/populating cache...') + log.info('dataset fetched and updated') db.populate_db() else: log.info('no changes since last update') - elif args.populate: - log.info('creating/populating cache...') - db.populate_db() - else: - parser.print_help(sys.stderr) + + if args.host and args.port: + log.info(f'listening on {args.host}:{args.port}') + listen = Listener(db, args.host, args.port) + |