From 02fb625230568d57bd68fd4d3274a2bc7eaf1701 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Thu, 14 Mar 2024 15:59:03 -0400 Subject: [PATCH] Correctly handle entry names with spaces in PowerShell completion --- extra/completion.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/extra/completion.ps1 b/extra/completion.ps1 index 7238c0b..042f843 100644 --- a/extra/completion.ps1 +++ b/extra/completion.ps1 @@ -1,6 +1,6 @@ Class libmuttonEntries : System.Management.Automation.IValidateSetValuesGenerator { [string[]] GetValidValues() { - #$entryPath = (Resolve-Path '~/.local/share/libmutton').Path + #$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 '\\', '/'} return [string[]] $entryNames @@ -45,5 +45,6 @@ function mutn { [ArgumentCompleter({ MUTNArgumentCompleter @args })] [string]$option ) - Invoke-Expression -Command "mutn.exe $entry $argument $option".Trim() + #Invoke-Expression -Command ('/usr/local/bin/mutn ' + ($entry -replace ' ', '` '), $argument, $option).Trim() # UNIX testing + Invoke-Expression -Command ('mutn.exe ' + ($entry -replace ' ', '` '), $argument, $option).Trim() }