def generate_header_file_callbacks_recursive(parent, command, h):
    """
    Generates a struct with callbacks, one callback for each subcommand.
    These callbacks are called when user issues a subcommand.
    """
    if parent is None:
        h += "struct CliCallbacks {\n"

    callback_name = command.get("callbackName", None)
    if callback_name is not None:
        struct_name = command.get("cppStructName", None)
        h += f"std::function<void(const std::shared_ptr<{struct_name}>&)> {callback_name};\n"

    for subcommand in command.get("subcommands", []):
        h = generate_header_file_callbacks_recursive("<not root>", subcommand, h)

    if parent is None:
        h += "};\n\n"

    return h