MCPcopy Create free account
hub / github.com/Icinga/icinga2 / GetCommandLine

Method GetCommandLine

lib/icinga/compatutility.cpp:20–40  ·  view source on GitHub ↗

Used in DB IDO and Livestatus. */

Source from the content-addressed store, hash-verified

18
19/* Used in DB IDO and Livestatus. */
20String CompatUtility::GetCommandLine(const Command::Ptr& command)
21{
22 Value commandLine = command->GetCommandLine();
23
24 String result;
25 if (commandLine.IsObjectType<Array>()) {
26 Array::Ptr args = commandLine;
27
28 ObjectLock olock(args);
29 for (String arg : args) {
30 // This is obviously incorrect for non-trivial cases.
31 result += " \"" + EscapeString(arg) + "\"";
32 }
33 } else if (!commandLine.IsEmpty()) {
34 result = EscapeString(Convert::ToString(commandLine));
35 } else {
36 result = "<internal>";
37 }
38
39 return result;
40}
41
42String CompatUtility::GetCommandNamePrefix(const Command::Ptr& command)
43/* Helper. */

Callers 4

PrepareObjectMethod · 0.80
ScriptFuncMethod · 0.80
ScriptFuncMethod · 0.80
ExecuteCommandMethod · 0.80

Calls 1

IsEmptyMethod · 0.45

Tested by

no test coverage detected