def generate_yaml_from_list_implementation(input_filepath): """ Generate YAML document from a list of urls provided by file. """ db = xapian.WritableDatabase(DATABASE_DIR, xapian.DB_CREATE_OR_OPEN) docs = [] with open(input_filepath, "r") as fh: urls = fh.read().split("\n") for url in urls: docid = get_docid(db, url) if not docid: continue doc = db.get_document(docid) docs.append(doc) return docs @cli.command('generate_yaml_from_list', short_help="blah") @click.argument("filepath") def generate_yaml_from_list(filepath): """ Generate YAML output from a list of URLs. """ docs = generate_yaml_from_list_implementation(filepath) #print_docs(docs) yamloutput = docs2yaml(docs) print(yamloutput)