import sys from .config import Config from .util import term from .repo import Repo def main(args): try: config = Config(args[0] if len(args) else '/etc/pacman-repo.d') print(config.path) print('---') print() print(config) print() for repo in config.repos: print(repo.path) print('---') print() print(repo) print() for server in config.servers: print(server.path) print('---') print() print(server) print() repos = [] for repo in config.repos: repo = Repo(repo) repos.append(repo) print("Repo: {}".format(repo.name)) for package in repo.packages: print(" {0}: {1}".format(package.name, package.url)) except Exception: from traceback import format_exc msg = "Error encountered:\n" + format_exc().strip() print(term().red(msg)) sys.exit(1) if __name__ == '__main__': main(sys.argv[1:])