Fix Bash completion for dirs when not using actual dir
This commit is contained in:
parent
03fdc62dce
commit
43d2d280e1
|
@ -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_FEATURES_FOR_COMPILER_DETECTION_HEADER cxx_thread_local)
|
||||||
set(META_VERSION_MAJOR 5)
|
set(META_VERSION_MAJOR 5)
|
||||||
set(META_VERSION_MINOR 0)
|
set(META_VERSION_MINOR 0)
|
||||||
set(META_VERSION_PATCH 0)
|
set(META_VERSION_PATCH 1)
|
||||||
|
|
||||||
# find required 3rd party libraries
|
# find required 3rd party libraries
|
||||||
include(3rdParty)
|
include(3rdParty)
|
||||||
|
|
|
@ -1521,16 +1521,21 @@ void ArgumentParser::printBashCompletion(int argc, const char *const *argv, unsi
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
auto dirEntryName = dirEntry.path().filename().string();
|
auto dirEntryName = dirEntry.path().filename().string();
|
||||||
|
auto hasStartingQuote = false;
|
||||||
if (useActualDir) {
|
if (useActualDir) {
|
||||||
if (!startsWith(dirEntryName, actualFile)) {
|
if (!startsWith(dirEntryName, actualFile)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
cout << '\'';
|
cout << '\'';
|
||||||
|
hasStartingQuote = true;
|
||||||
if (actualDir != ".") {
|
if (actualDir != ".") {
|
||||||
cout << actualDir;
|
cout << actualDir;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
findAndReplace(dirEntryName, replace, with);
|
findAndReplace(dirEntryName, replace, with);
|
||||||
|
if (!hasStartingQuote) {
|
||||||
|
cout << '\'';
|
||||||
|
}
|
||||||
cout << dirEntryName << '\'' << ' ';
|
cout << dirEntryName << '\'' << ' ';
|
||||||
haveFileOrDirCompletions = true;
|
haveFileOrDirCompletions = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue