@belns.command()<EOL>@connection_option<EOL>@click.option('<STR_LIT>', '<STR_LIT>', multiple=True, help='<STR_LIT>')<EOL>@click.option('<STR_LIT>', '<STR_LIT>', type=click.Path(file_okay=False, dir_okay=True), default=os.getcwd(),<EOL>help='<STR_LIT>')<EOL>@click.option('<STR_LIT>', '<STR_LIT>', is_flag=True, help='<STR_LIT>')<EOL>def write(connection, skip, directory, force):
os.makedirs(directory, exist_ok=True)<EOL>from .manager.namespace_manager import BELNamespaceManagerMixin<EOL>for idx, name, manager in _iterate_managers(connection, skip):<EOL><INDENT>if not (isinstance(manager, AbstractManager) and isinstance(manager, BELNamespaceManagerMixin)):<EOL><INDENT>continue<EOL><DEDENT>click.secho(name, fg='<STR_LIT>', bold=True)<EOL>if force:<EOL><INDENT>try:<EOL><INDENT>click.echo(f'<STR_LIT>')<EOL>manager.drop_all()<EOL>click.echo('<STR_LIT>')<EOL>clear_cache(name)<EOL>click.echo('<STR_LIT>')<EOL>manager.populate()<EOL><DEDENT>except Exception:<EOL><INDENT>click.secho(f'<STR_LIT>', fg='<STR_LIT>')<EOL>continue<EOL><DEDENT><DEDENT>try:<EOL><INDENT>r = manager.write_directory(directory)<EOL><DEDENT>except TypeError as e:<EOL><INDENT>click.secho(f'<STR_LIT>'.rstrip(), fg='<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>if not r:<EOL><INDENT>click.echo('<STR_LIT>')<EOL><DEDENT><DEDENT><DEDENT>
Write a BEL namespace names/identifiers to terminology store.