Browse Source

Fix Bash completion for dirs when not using actual dir

charconv
Martchus 2 years ago
parent
commit
43d2d280e1
  1. 2
      CMakeLists.txt
  2. 5
      application/argumentparser.cpp

2
CMakeLists.txt

@ -113,7 +113,7 @@ set(META_APP_DESCRIPTION "Useful C++ classes and routines such as argument parse
set(META_FEATURES_FOR_COMPILER_DETECTION_HEADER cxx_thread_local)
set(META_VERSION_MAJOR 5)
set(META_VERSION_MINOR 0)
set(META_VERSION_PATCH 0)
set(META_VERSION_PATCH 1)
# find required 3rd party libraries
include(3rdParty)

5
application/argumentparser.cpp

@ -1521,16 +1521,21 @@ void ArgumentParser::printBashCompletion(int argc, const char *const *argv, unsi
continue;
}
auto dirEntryName = dirEntry.path().filename().string();
auto hasStartingQuote = false;
if (useActualDir) {
if (!startsWith(dirEntryName, actualFile)) {
continue;
}
cout << '\'';
hasStartingQuote = true;
if (actualDir != ".") {
cout << actualDir;
}
}
findAndReplace(dirEntryName, replace, with);
if (!hasStartingQuote) {
cout << '\'';
}
cout << dirEntryName << '\'' << ' ';
haveFileOrDirCompletions = true;
}

Loading…
Cancel
Save