<commit_before>#include <iostream>
#include <vector>

#include <boost/algorithm/string.hpp>
#include <boost/program_options.hpp>

#include "dafs/dafs-cli.hpp"
#include "dafs/messages.hpp"
#include "dafs/metadataparser.hpp"
#include "dafs/sender.hpp"
#include "dafs/serialization.hpp"


namespace dafs
{
    void
    GetNodeDetails(
        dafs::Address address,
        std::vector<std::string> args)
    {
        auto message = dafs::Message
        {
            address, // from
            address, // to
            dafs::MessageType::GetNodeDetails,
            std::vector<dafs::MetaData>
            {
            }
        };
        auto sender = boost::make_shared<dafs::NetworkSender>();
        sender->Send(message);
        auto result = sender->Receive();
        auto parser = dafs::MetaDataParser(result.metadata);

        auto p_minus = parser.GetValue<dafs::ReplicatedEndpoints>(dafs::MinusReplicatedEndpointsKey);
        auto p_zero = parser.GetValue<dafs::ReplicatedEndpoints>(dafs::ZeroReplicatedEndpointsKey);
        auto p_plus = parser.GetValue<dafs::ReplicatedEndpoints>(dafs::PlusReplicatedEndpointsKey);

        auto p_minus_id = parser.GetValue<dafs::Identity>(dafs::MinusIdentityKey);
        auto p_zero_id = parser.GetValue<dafs::Identity>(dafs::ZeroIdentityKey);
        auto p_plus_id = parser.GetValue<dafs::Identity>(dafs::PlusIdentityKey);

        std::cout << "Node info:\n"
                  << "  - p-minus" << std::endl
                  << "      - author"  << std::endl
                  << "           ip: " << p_minus.zero.management.ip << std::endl
                  << "           port: " << p_minus.zero.management.port << std::endl
                  << "      - identity"  << std::endl
                  << "           uuid: " << p_minus_id.id << std::endl
                  << "  - p-zero" << std::endl
                  << "      - author"  << std::endl
                  << "           ip: " << p_zero.zero.management.ip << std::endl
                  << "           port: " << p_zero.zero.management.port << std::endl
                  << "      - identity"  << std::endl
                  << "           uuid: " << p_zero_id.id << std::endl
                  << "  - p-plus" << std::endl
                  << "      - author"  << std::endl
                  << "           ip: " << p_plus.zero.management.ip << std::endl
                  << "           port: " << p_plus.zero.management.port << std::endl
                  << "      - identity"  << std::endl
                  << "           uuid: " << p_plus_id.id << std::endl;
    }


    void
    ExecuteWriteBlock(
        dafs::Address address,
        std::vector<std::string> args)
    {
        dafs::BlockInfo info
        {
            "path_to_block_info",
            dafs::Identity("11111111-1111-1111-1111-111111111111"),
            0 // revision
        };

        dafs::BlockFormat format
        {
            "this is rawr contents of the block format..."
        };
        auto message = dafs::Message<commit_msg>Add replicated endpoints output in dafs-cli<commit_after>#include <iostream>
#include <vector>

#include <boost/algorithm/string.hpp>
#include <boost/program_options.hpp>

#include "dafs/dafs-cli.hpp"
#include "dafs/messages.hpp"
#include "dafs/metadataparser.hpp"
#include "dafs/sender.hpp"
#include "dafs/serialization.hpp"


namespace dafs
{
    std::string
    EndpointToString(dafs::Endpoint address)
    {
        std::stringstream result;
        result << "{" << address.management.ip
               << ":" << address.management.port << "}"
               << "{" << address.replication.ip
               << ":" << address.replication.port << "}";
        return result.str();
    }

    void
    GetNodeDetails(
        dafs::Address address,
        std::vector<std::string> args)
    {
        auto message = dafs::Message
        {
            address, // from
            address, // to
            dafs::MessageType::GetNodeDetails,
            std::vector<dafs::MetaData>
            {
            }
        };
        auto sender = boost::make_shared<dafs::NetworkSender>();
        sender->Send(message);
        auto result = sender->Receive();
        auto parser = dafs::MetaDataParser(result.metadata);

        auto p_minus = parser.GetValue<dafs::ReplicatedEndpoints>(dafs::MinusReplicatedEndpointsKey);
        auto p_zero = parser.GetValue<dafs::ReplicatedEndpoints>(dafs::ZeroReplicatedEndpointsKey);
        auto p_plus = parser.GetValue<dafs::ReplicatedEndpoints>(dafs::PlusReplicatedEndpointsKey);

        auto p_minus_id = parser.GetValue<dafs::Identity>(dafs::MinusIdentityKey);
        auto p_zero_id = parser.GetValue<dafs::Identity>(dafs::ZeroIdentityKey);
        auto p_plus_id = parser.GetValue<dafs::Identity>(dafs::PlusIdentityKey);

        std::cout
            << "Node info:\n"
            << " - p-minus" << std::endl
            << "     - identity"  << std::endl
            << "          " << p_minus_id.id << std::endl
            << "     - plus"  << std::endl
            << "          " << EndpointToString(p_minus.plus) << std::endl
            << "     - zero"  << std::endl
            << "          " << EndpointToString(p_minus.zero) << std::endl
            << "     - minus"  << std::endl
            << "          " << EndpointToString(p_minus.minus) << std::endl
            << " - p-zero" << std::endl
            << "     - identity"  << std::endl
            << "         " << p_zero_id.id << std::endl
            << "     - plus"  << std::endl
            << "          " << EndpointToString(p_zero.plus) << std::endl
            << "     - zero"  << std::endl
            << "          " << EndpointToString(p_zero.zero) << std::endl
            << "     - minus"  << std::endl
            << "          " << EndpointToString(p_zero.minus) << std::endl
            << " - p-plus" << std::endl
            << "          " << p_plus_id.id << std::endl
            << "     - plus"  << std::endl
            << "          " << EndpointToString(p_plus.plus) << std::endl
            << "     - zero"  << std::endl
            << "          " << EndpointToString(p_plus.zero) << std::endl
            << "     - minus"  << std::endl
            << "          " << EndpointToString(p_plus.minus) << std::endl;
    }


    void
    ExecuteWriteBlock(
        dafs::Address address,
        std::vector<std::string> args)
    {
        dafs::BlockInfo info
        {
            "path_to_block_info",
            dafs::Identity("11111111-1111-1111-1111-111111111111"),
            0 // revision
        };

        dafs::BlockFormat format
        {
            "this is rawr contents of the block format..."
        };
        auto message = dafs::Message
{'fraction_non_alphanumeric': 0.149933461481591, 'fraction_numerical': 0.009758982699985213, 'mean_word_length': 1.755193482688391, 'pattern_counts': {'":': 2, '<': 273, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 9, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3693693', 'n_tokens_mistral': 2046, 'n_tokens_neox': 1961, 'n_words': 295}