Do not auto-complete directories in shell completions (only entries)

This commit is contained in:
2024-03-18 14:39:55 -04:00
parent 26a5898e15
commit e4de8f930b
3 changed files with 21 additions and 19 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ function MUTNEntryCompleter {
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
#$entryPath = (Resolve-Path '~/.local/share/libmutton').Path # UNIX testing
$entryPath = (Resolve-Path '~/AppData/Local/libmutton/entries').Path
$entryNames = If (Test-Path $entryPath) {(Get-ChildItem -Path $entryPath -Recurse).FullName.Substring($entryPath.Length) -replace '\\', '/' -replace ' ', '` '}
$entryNames = If (Test-Path $entryPath) {(Get-ChildItem -Path $entryPath -Recurse -File).FullName.Substring($entryPath.Length) -replace '\\', '/' -replace ' ', '` '}
$entryNames | Where-Object { $_ -like "$wordToComplete*" }
}