def export_registry()

in nubia/internal/registry_tools.py [0:0]


def export_registry(plugin, args, opts_parser, registry):
    cmds = registry.get_all_commands()
    commands = []
    for cmd in cmds:
        if cmd.built_in:
            continue
        inspection = cmd.metadata
        if isinstance(inspection, FunctionInspection):
            commands.append(_fn_to_dict(inspection))
        else:
            logger.warning("Command %s is not instance of FunctionInspection", cmd)

    model = {
        "commands": commands,
        # This will include the shell top-level options, this will be included
        # in a future diff
        "options": _dump_opts_parser_common(opts_parser, plugin),
    }
    return json.dumps(model)