From 2dc5219adfbc01223cd4c156f0af21b44c938187 Mon Sep 17 00:00:00 2001 From: Martchus Date: Fri, 28 Jul 2017 19:35:49 +0200 Subject: [PATCH] Log bash-completion args --- application/argumentparser.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/application/argumentparser.cpp b/application/argumentparser.cpp index 85a242f..6561520 100644 --- a/application/argumentparser.cpp +++ b/application/argumentparser.cpp @@ -14,6 +14,9 @@ #include #include #include +#ifdef DEBUG_BUILD +#include +#endif using namespace std; using namespace std::placeholders; @@ -680,6 +683,15 @@ void ArgumentParser::readArgs(int argc, const char *const *argv) bool completionMode = !strcmp(*++argv, "--bash-completion-for"); unsigned int currentWordIndex; if (completionMode) { +#ifdef DEBUG_BUILD + { + fstream completionLog(argsToString("/tmp/", applicationName, "-bash-completion.log"), ios_base::out | ios_base::app); + for (const char *const *i = argv, *const *end = argv + argc; i != end; ++i) { + completionLog << '\"' << *i << '\"' << ' '; + } + completionLog << '\n'; + } +#endif // the first argument after "--bash-completion-for" is the index of the current word try { currentWordIndex = (--argc ? stringToNumber(*(++argv)) : 0);