mirror of
https://github.com/rwinkhart/MUTN.git
synced 2026-09-05 16:47:20 -04:00
Call mutn.exe from PowerShell completion function
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
Class libmuttonEntries : System.Management.Automation.IValidateSetValuesGenerator {
|
Class libmuttonEntries : System.Management.Automation.IValidateSetValuesGenerator {
|
||||||
[string[]] GetValidValues() {
|
[string[]] GetValidValues() {
|
||||||
|
#$entryPath = (Resolve-Path '~/.local/share/libmutton').Path
|
||||||
$entryPath = (Resolve-Path '~/AppData/Local/libmutton/entries').Path
|
$entryPath = (Resolve-Path '~/AppData/Local/libmutton/entries').Path
|
||||||
$entryNames = If (Test-Path $entryPath) {(Get-ChildItem -Path $entryPath -Recurse).FullName.Substring($entryPath.Length) -replace '\\', '/'}
|
$entryNames = If (Test-Path $entryPath) {(Get-ChildItem -Path $entryPath -Recurse).FullName.Substring($entryPath.Length) -replace '\\', '/'}
|
||||||
return [string[]] $entryNames
|
return [string[]] $entryNames
|
||||||
@@ -38,10 +39,11 @@ function mutn {
|
|||||||
|
|
||||||
[Parameter(Position = 1)]
|
[Parameter(Position = 1)]
|
||||||
[ArgumentCompletions('add', 'gen', 'edit', 'copy', 'shear')]
|
[ArgumentCompletions('add', 'gen', 'edit', 'copy', 'shear')]
|
||||||
$argument,
|
[string]$argument,
|
||||||
|
|
||||||
[Parameter(Position = 2)]
|
[Parameter(Position = 2)]
|
||||||
[ArgumentCompleter({ MUTNArgumentCompleter @args })]
|
[ArgumentCompleter({ MUTNArgumentCompleter @args })]
|
||||||
$option
|
[string]$option
|
||||||
)
|
)
|
||||||
|
Invoke-Expression -Command "mutn.exe $entry $argument $option".Trim()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user