Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/qt/rpcconsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -856,8 +856,17 @@ void RPCConsole::walletReindex()
void RPCConsole::buildParameterlist(QString arg)
{
// Get command-line arguments and remove the application name
QStringList args = QApplication::arguments();
args.removeFirst();
QStringList args;

for (const auto& [key, values] : gArgs.GetCommandLineArgs()) {
for (const auto& value : values) {
if (value.empty()) {
args << QString::fromStdString(key);
} else {
args << QString::fromStdString(key + "=" + value);
}
}
}

// Remove existing repair-options
args.removeAll(SALVAGEWALLET);
Expand Down
8 changes: 8 additions & 0 deletions src/util/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ bool ArgsManager::ParseParameters(int argc, const char* const argv[], std::strin
{
LOCK(cs_args);
m_override_args.clear();
m_command_line_args.clear();

for (int i = 1; i < argc; i++) {
std::string key(argv[i]);
Expand Down Expand Up @@ -438,6 +439,7 @@ bool ArgsManager::ParseParameters(int argc, const char* const argv[], std::strin
if (!InterpretOption(key, val, flags, m_override_args, error)) {
return false;
}
m_command_line_args[key].push_back(val);
} else {
error = strprintf("Invalid parameter %s", key.c_str());
return false;
Expand All @@ -457,6 +459,12 @@ bool ArgsManager::ParseParameters(int argc, const char* const argv[], std::strin
return true;
}

const std::map<std::string, std::vector<std::string>> ArgsManager::GetCommandLineArgs() const
{
LOCK(cs_args);
return m_command_line_args;
}

unsigned int ArgsManager::FlagsOfKnownArg(const std::string& key) const
{
assert(key[0] == '-');
Expand Down
6 changes: 6 additions & 0 deletions src/util/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ class ArgsManager

mutable CCriticalSection cs_args;
std::map<std::string, std::vector<std::string>> m_override_args GUARDED_BY(cs_args);
std::map<std::string, std::vector<std::string>> m_command_line_args GUARDED_BY(cs_args);
std::map<std::string, std::vector<std::string>> m_config_args GUARDED_BY(cs_args);
std::string m_network GUARDED_BY(cs_args);
std::set<std::string> m_network_only_args GUARDED_BY(cs_args);
Expand Down Expand Up @@ -225,6 +226,11 @@ class ArgsManager
*/
const std::list<SectionInfo> GetUnrecognizedSections() const;

/**
* Return the map of all the args passed via cmd line
*/
const std::map<std::string, std::vector<std::string>> GetCommandLineArgs() const;

/**
* Return a vector of strings of the given argument
*
Expand Down