def execute(self, args): """Execute the command.""" root_dir = args.directory if not os.path.exists(root_dir): print("The {} directory doesn't exist".format(repr(root_dir)), file=sys.stderr) sys.exit(1) elif not os.path.isdir(root_dir): print("The {} path doesn't lead to a directory".format( repr(root_dir)), file=sys.stderr) sys.exit(1) loader = FSLoader(root_dir) loader.load() nb = loader.update_catalog(args.catalog, args.model) print("Successfully updated the '{}' catalog ({})".format( args.catalog, nb))
def execute(self, args): """Execute the command.""" root_dir = args.directory if not os.path.exists(root_dir): print("The {} directory doesn't exist".format(repr(root_dir)), file=sys.stderr) sys.exit(1) elif not os.path.isdir(root_dir): print("The {} path doesn't lead to a directory".format( repr(root_dir)), file=sys.stderr) sys.exit(1) loader = FSLoader(root_dir) loader.load() if args.catalog: self.display_catalog(loader, args.catalog) elif loader.catalogs: self.display_catalogs(loader) else: print("No catalog could be found in {}".format(repr(root_dir)), file=sys.stderr)