From 25e92640cd9363877d416cd3ced5eab3f0f81d01 Mon Sep 17 00:00:00 2001 From: Mike Battista <13860912+mikebattista@users.noreply.github.com> Date: Mon, 20 Apr 2020 17:55:05 -0700 Subject: [PATCH] Fixed #26. --- WslInterop.psd1 | 2 +- WslInterop.psm1 | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/WslInterop.psd1 b/WslInterop.psd1 index 2f507e4..afec772 100644 --- a/WslInterop.psd1 +++ b/WslInterop.psd1 @@ -12,7 +12,7 @@ RootModule = '.\WslInterop.psm1' # Version number of this module. -ModuleVersion = '0.2.2' +ModuleVersion = '0.2.3' # Supported PSEditions CompatiblePSEditions = 'Core' diff --git a/WslInterop.psm1 b/WslInterop.psm1 index 8de6425..7aac438 100644 --- a/WslInterop.psm1 +++ b/WslInterop.psm1 @@ -122,7 +122,7 @@ function global:Import-WslCommand() { # Map the command to the appropriate bash completion function. if (-not $global:WslCompletionFunctions.Contains($command)) { # Try to find the completion function. - $global:WslCompletionFunctions[$command] = wsl.exe (". /usr/share/bash-completion/bash_completion 2> /dev/null; __load_completion $command 2> /dev/null; complete -p $command 2> /dev/null | sed -E 's/^complete.*-F ([^ ]+).*`$/\1/'" -split ' ') + $global:WslCompletionFunctions[$command] = wsl.exe bash -c ". /usr/share/bash-completion/bash_completion 2> /dev/null; __load_completion $command 2> /dev/null; complete -p $command 2> /dev/null | sed -E 's/^complete.*-F ([^ ]+).*`$/\1/'" # If we can't find a completion function, default to _minimal which will resolve Linux file paths. if ($null -eq $global:WslCompletionFunctions[$command] -or $global:WslCompletionFunctions[$command] -like "complete*") { @@ -180,11 +180,11 @@ function global:Import-WslCommand() { $COMPINPUT = "COMP_LINE=$COMP_LINE; COMP_WORDS=$COMP_WORDS; COMP_CWORD=$COMP_CWORD; COMP_POINT=$cursorPosition" $COMPGEN = "bind `"set completion-ignore-case on`" 2> /dev/null; $($WslCompletionFunctions[$command]) `"$command`" `"$wordToComplete`" `"$previousWord`" 2> /dev/null" $COMPREPLY = "IFS=`$'\n'; echo `"`${COMPREPLY[*]}`"" - $commandLine = "$bashCompletion; $commandCompletion; $COMPINPUT; $COMPGEN; $COMPREPLY" -split ' ' + $commandLine = "$bashCompletion; $commandCompletion; $COMPINPUT; $COMPGEN; $COMPREPLY" # Invoke bash completion and return CompletionResults. $previousCompletionText = "" - (wsl.exe $commandLine) -split '\n' | + ($commandLine | wsl.exe bash -s) -split '\n' | Sort-Object -Unique -CaseSensitive | ForEach-Object { if ($_ -eq "") {