mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-22 22:04:33 +01:00
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:
File diff suppressed because it is too large
Load Diff
@@ -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);
|
||||
|
||||
@@ -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) */
|
||||
|
||||
Reference in New Issue
Block a user