Skip to content

Commit

Permalink
Fixed #26.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebattista committed Apr 21, 2020
1 parent 645e494 commit 25e9264
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion WslInterop.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = '.\WslInterop.psm1'

# Version number of this module.
ModuleVersion = '0.2.2'
ModuleVersion = '0.2.3'

# Supported PSEditions
CompatiblePSEditions = 'Core'
Expand Down
6 changes: 3 additions & 3 deletions WslInterop.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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*") {
Expand Down Expand Up @@ -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 "") {
Expand Down

0 comments on commit 25e9264

Please sign in to comment.