Compare commits

...

1 Commits

Author SHA1 Message Date
Martchus 2dc5219adf Log bash-completion args 4 years ago
  1. 12
      application/argumentparser.cpp

12
application/argumentparser.cpp

@ -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);

Loading…
Cancel
Save