<commit_before>/**
 * @file
 *
 * @brief source file of spec mount command
 *
 * @copyright BSD License (see doc/COPYING or http://www.libelektra.org)
 *
 */


#include <globalmount.hpp>
#include <cmdline.hpp>
#include <specreader.hpp>

#include <iostream>
#include <iterator>
#include <fstream>
#include <vector>
#include <string>

using namespace std;
using namespace kdb;
using namespace kdb::tools;

GlobalMountCommand::GlobalMountCommand()
{}

void GlobalMountCommand::buildBackend (Cmdline const& cl)
{
	GlobalPluginsBuilder backend;

	// TODO: impl globalPlugins conf param
	// backend.addPlugins (parseArguments (cl.globalPlugins));
	backend.addPlugins (parseArguments (cl.arguments.begin(), cl.arguments.end()));

	// Call it a day
	outputMissingRecommends(backend.resolveNeeds(cl.withRecommends));
	backend.serialize (mountConf);
}

/**
 * @brief Its quite linear whats going on, but there are many steps involved
 *
 * @param cl the commandline
 *
 * @retval 0 on success (otherwise exception)
 */
int GlobalMountCommand::execute (Cmdline const& cl)
{
	mountpointsPath = GlobalPluginsBuilder::globalPluginsPath;
	readMountConf(cl);

	buildBackend(cl);
	doIt();

	return 0;<commit_msg>kdb: cleanup global mountpoints before mounting<commit_after>/**
 * @file
 *
 * @brief source file of spec mount command
 *
 * @copyright BSD License (see doc/COPYING or http://www.libelektra.org)
 *
 */


#include <globalmount.hpp>
#include <cmdline.hpp>
#include <specreader.hpp>

#include <iostream>
#include <iterator>
#include <fstream>
#include <vector>
#include <string>

using namespace std;
using namespace kdb;
using namespace kdb::tools;

GlobalMountCommand::GlobalMountCommand()
{}

void GlobalMountCommand::buildBackend (Cmdline const& cl)
{
	GlobalPluginsBuilder backend;

	// TODO: impl globalPlugins conf param
	// backend.addPlugins (parseArguments (cl.globalPlugins));
	backend.addPlugins (parseArguments (cl.arguments.begin(), cl.arguments.end()));

	// Call it a day
	outputMissingRecommends(backend.resolveNeeds(cl.withRecommends));
	mountConf.cut (Key("system/elektra/globalplugins", KEY_END));
	backend.serialize (mountConf);
}

/**
 * @brief Its quite linear whats going on, but there are many steps involved
 *
 * @param cl the commandline
 *
 * @retval 0 on success (otherwise exception)
 */
int GlobalMountCommand::execute (Cmdline const& cl)
{
	mountpointsPath = GlobalPluginsBuilder::globalPluginsPath;
	readMountConf(cl);

	buildBackend(cl);
	doIt();

	return 0;
{'fraction_non_alphanumeric': 0.12303980699638119, 'fraction_numerical': 0.0016083634901487736, 'mean_word_length': 5.395886889460154, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7563349', 'n_tokens_mistral': 786, 'n_tokens_neox': 769, 'n_words': 213}