forked from EvergreenCrypto/docker-finance
container: root: common: allow quotations in Pluggable arguments
Helps facilitate CLI usage; e.g., $ dfi testprofile/testuser root plugins/repo/bitcoin/bitcoin.cc 'dfi::macro::load(\"repo/test/unit.C\")'
This commit is contained in:
@@ -26,8 +26,10 @@
|
||||
#include <ctime>
|
||||
#include <filesystem>
|
||||
#include <initializer_list>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
@@ -619,11 +621,17 @@ class Pluggable
|
||||
// Load pluggable file
|
||||
::dfi::common::load(m_plug.path().absolute());
|
||||
|
||||
// Execute pluggable's loader
|
||||
const std::string s{
|
||||
// Prepare pluggable entry
|
||||
const std::string entry{
|
||||
"dfi::" + m_plug.space().outer() + "::" + m_plug.space().inner()
|
||||
+ "::" + m_plug.space().entry()};
|
||||
::dfi::common::line(s + "::load(\"" + m_plug.args().load() + "\")");
|
||||
|
||||
// Allow quotations in loader argument
|
||||
std::stringstream arg;
|
||||
arg << std::quoted(m_plug.args().load());
|
||||
|
||||
// Execute pluggable's loader
|
||||
::dfi::common::line(entry + "::load(" + arg.str() + ")");
|
||||
|
||||
return *this;
|
||||
}
|
||||
@@ -634,11 +642,17 @@ class Pluggable
|
||||
//! \since docker-finance 1.1.0
|
||||
const auto& unload() const
|
||||
{
|
||||
// Execute pluggable's unloader
|
||||
const std::string s{
|
||||
// Prepare pluggable entry
|
||||
const std::string entry{
|
||||
"dfi::" + m_plug.space().outer() + "::" + m_plug.space().inner()
|
||||
+ "::" + m_plug.space().entry()};
|
||||
::dfi::common::line(s + "::unload(\"" + m_plug.args().unload() + "\")");
|
||||
|
||||
// Allow quotations in unloader argument
|
||||
std::stringstream arg;
|
||||
arg << std::quoted(m_plug.args().unload());
|
||||
|
||||
// Execute pluggable's unloader
|
||||
::dfi::common::line(entry + "::unload(" + arg.str() + ")");
|
||||
|
||||
// Unload pluggable file
|
||||
::dfi::common::unload(m_plug.path().absolute());
|
||||
|
||||
Reference in New Issue
Block a user