Dev/document autocomplete (#1004)

* fixed the gendoc to reflect the new parser, updated documentation to include info about autocomplete in the command line part, error in createing docs

* fixed list deprecated, fixed command help (to show properly on a html, fixed other help warnings

* minor indents

---------

Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com>
This commit is contained in:
2024-10-21 16:39:50 +02:00
committed by GitHub
parent 0b9fd0664e
commit 6fcdba56a4
12 changed files with 137 additions and 375 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -55,6 +55,7 @@ class Caller {
}
std::vector<std::string> getAllCommands();
std::map<std::string, std::string> GetDeprecatedCommands();
std::string list(int action);
std::string acquire(int action);

View File

@@ -16,6 +16,10 @@ std::vector<std::string> Caller::getAllCommands() {
return ret;
}
std::map<std::string, std::string> Caller::GetDeprecatedCommands() {
return deprecated_functions;
}
void Caller::call(const std::string &command,
const std::vector<std::string> &arguments, int detector_id,
int action, std::ostream &os, int receiver_id) {
@@ -63,12 +67,35 @@ bool Caller::ReplaceIfDeprecated(std::string &command) {
}
std::string Caller::list(int action) {
std::string ret = "free\n";
for (auto &f : functions) {
ret += f.first + "\n";
if (action == defs::HELP_ACTION) {
return "[deprecated(optional)]\n\tlists all available commands, list "
"deprecated - list deprecated commands\n";
}
if (args.empty()) {
std::string ret = "free\n";
for (auto &f : functions) {
ret += f.first + "\n";
}
return ret;
} else if (args.size() == 1) {
if (args[0] == "deprecated") {
std::ostringstream os;
os << "The following " << deprecated_functions.size()
<< " commands are deprecated\n";
const size_t field_width = 20;
for (const auto &it : deprecated_functions) {
os << std::right << std::setw(field_width) << it.first << " -> "
<< it.second << '\n';
}
return os.str();
} else {
throw RuntimeError(
"Could not decode argument. Possible options: deprecated");
}
} else {
WrongNumberOfParameters(0);
return "";
}
return ret;
}
/* Network Configuration (Detector<->Receiver) */