}
}
}
+
+#ifndef DISABLE_COMPLETION
/**** CARGO CULT CODE AHEAD ****/
const std::vector<ConsoleKeyword> g_consoleKeywords{
/* keyword, function, parameters, description */
return matches;
}
}
+#endif /* DISABLE_COMPLETION */
static void controlClientThread(ConsoleConnection&& conn)
{
*/
#pragma once
+#include "config.h"
+
+#ifndef DISABLE_COMPLETION
struct ConsoleKeyword {
std::string name;
bool function;
return res;
}
};
+extern const std::vector<ConsoleKeyword> g_consoleKeywords;
+extern "C" {
+char** my_completion( const char * text , int start, int end);
+}
+
+#endif /* DISABLE_COMPLETION */
extern GlobalStateHolder<NetmaskGroup> g_consoleACL;
-extern const std::vector<ConsoleKeyword> g_consoleKeywords;
extern std::string g_consoleKey; // in theory needs locking
extern bool g_logConsoleConnections;
extern bool g_consoleEnabled;
void doClient(ComboAddress server, const std::string& command);
void doConsole();
-extern "C" {
-char** my_completion( const char * text , int start, int end);
-}
void controlThread(int fd, ComboAddress local);
void clearConsoleHistory();
luaCtx.writeFunction("help", [](boost::optional<std::string> command) {
setLuaNoSideEffect();
g_outputBuffer = "";
+#ifndef DISABLE_COMPLETION
for (const auto& keyword : g_consoleKeywords) {
if (!command) {
g_outputBuffer += keyword.toString() + "\n";
return;
}
}
+#endif /* DISABLE_COMPLETION */
if (command) {
g_outputBuffer = "Nothing found for " + *command + "\n";
}
try {
size_t udpBindsCount = 0;
size_t tcpBindsCount = 0;
+#ifndef DISABLE_COMPLETION
rl_attempted_completion_function = my_completion;
rl_completion_append_character = 0;
+#endif /* DISABLE_COMPLETION */
signal(SIGPIPE, SIG_IGN);
signal(SIGCHLD, SIG_IGN);