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 <ctime>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
|
#include <iomanip>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -619,11 +621,17 @@ class Pluggable
|
|||||||
// Load pluggable file
|
// Load pluggable file
|
||||||
::dfi::common::load(m_plug.path().absolute());
|
::dfi::common::load(m_plug.path().absolute());
|
||||||
|
|
||||||
// Execute pluggable's loader
|
// Prepare pluggable entry
|
||||||
const std::string s{
|
const std::string entry{
|
||||||
"dfi::" + m_plug.space().outer() + "::" + m_plug.space().inner()
|
"dfi::" + m_plug.space().outer() + "::" + m_plug.space().inner()
|
||||||
+ "::" + m_plug.space().entry()};
|
+ "::" + 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;
|
return *this;
|
||||||
}
|
}
|
||||||
@@ -634,11 +642,17 @@ class Pluggable
|
|||||||
//! \since docker-finance 1.1.0
|
//! \since docker-finance 1.1.0
|
||||||
const auto& unload() const
|
const auto& unload() const
|
||||||
{
|
{
|
||||||
// Execute pluggable's unloader
|
// Prepare pluggable entry
|
||||||
const std::string s{
|
const std::string entry{
|
||||||
"dfi::" + m_plug.space().outer() + "::" + m_plug.space().inner()
|
"dfi::" + m_plug.space().outer() + "::" + m_plug.space().inner()
|
||||||
+ "::" + m_plug.space().entry()};
|
+ "::" + 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
|
// Unload pluggable file
|
||||||
::dfi::common::unload(m_plug.path().absolute());
|
::dfi::common::unload(m_plug.path().absolute());
|
||||||
|
|||||||
Reference in New Issue
Block a user