From fb984f451485db7cfe635523d81897682321bd52 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Thu, 14 Mar 2024 14:47:49 -0400 Subject: [PATCH] Call mutn.exe from PowerShell completion function --- extra/completion.ps1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/extra/completion.ps1 b/extra/completion.ps1 index bcdf692..7238c0b 100644 --- a/extra/completion.ps1 +++ b/extra/completion.ps1 @@ -1,5 +1,6 @@ Class libmuttonEntries : System.Management.Automation.IValidateSetValuesGenerator { [string[]] GetValidValues() { + #$entryPath = (Resolve-Path '~/.local/share/libmutton').Path $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 @@ -38,10 +39,11 @@ function mutn { [Parameter(Position = 1)] [ArgumentCompletions('add', 'gen', 'edit', 'copy', 'shear')] - $argument, + [string]$argument, [Parameter(Position = 2)] [ArgumentCompleter({ MUTNArgumentCompleter @args })] - $option + [string]$option ) + Invoke-Expression -Command "mutn.exe $entry $argument $option".Trim() }