Compare commits

...

1 Commits

Author SHA1 Message Date
Martchus 2dc5219adf Log bash-completion args 2017-07-28 19:35:49 +02:00
1 changed files with 12 additions and 0 deletions

View File

@ -14,6 +14,9 @@
#include <iostream>
#include <sstream>
#include <string>
#ifdef DEBUG_BUILD
#include <fstream>
#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<unsigned int, string>(*(++argv)) : 0);